• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Helpers.FastScanner类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CFTraining.Helpers.FastScanner的典型用法代码示例。如果您正苦于以下问题:C# FastScanner类的具体用法?C# FastScanner怎么用?C# FastScanner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FastScanner类属于CFTraining.Helpers命名空间,在下文中一共展示了FastScanner类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Run

 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int q = fs.NextInt();
         long u, v, w;
         List<Edge> path;
         while (q-- > 0)
         {
             int t = fs.NextInt();
             if (t == 1)
             {
                 u = fs.NextLong();
                 v = fs.NextLong();
                 w = fs.NextLong();
                 path = GetPath(u, v);
                 foreach (var edge in path)
                 {
                     if (!costs.ContainsKey(edge)) costs.Add(edge, 0);
                     costs[edge] += w;
                 }
             }
             else
             {
                 u = fs.NextLong();
                 v = fs.NextLong();
                 path = GetPath(u, v);
                 writer.WriteLine(GetCost(path));
             }
         }
     }
 }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:33,代码来源:LorenzoVonMatterhorn362.cs


示例2: Run

 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt();
         a = new int[n];
         adjList = new LinkedList<Edge1>[n];
         for (int i = 0; i < n; i++)
         {
             adjList[i] = new LinkedList<Edge1>();
             a[i] = fs.NextInt();
         }
         for (int i = 0; i < n - 1; i++)
         {
             int p = fs.NextInt() - 1, c = fs.NextInt();
             adjList[i + 1].AddLast(new Edge1 { v = p, w = c });
             adjList[p].AddLast(new Edge1 { v = i + 1, w = c });
         }
         childNum = new int[n];
         GetChildNum(0, new bool[n]);
         long ans = VerticesToRemove(0, 0, new bool[n]);
         writer.WriteLine(ans);
     }
 }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:25,代码来源:AlyonaAndTree358.cs


示例3: Run

 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt();
         int[] rows = new int[n], cols = new int[n];
         for (int i = 0; i < n; i++)
         {
             string s = fs.ReadLine();
             for (int j = 0; j < n; j++)
             {
                 if (s[j] == 'C')
                 {
                     rows[i]++;
                     cols[j]++;
                 }
             }
         }
         long ans = 0;
         for (int i = 0; i < n; i++)
         {
             ans += (rows[i] * (rows[i] - 1)) / 2;
             ans += (cols[i] * (cols[i] - 1)) / 2;
         }
         writer.WriteLine(ans);
     }
 }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:28,代码来源:BirthdayCake343.cs


示例4: Run

 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int t = fs.NextInt();
         for (int i = 1; i <= t; i++)
         {
             long w = fs.NextLong();
             if ((w & 1) == 0)
             {
                 long m = 1;
                 while ((w & 1) == 0)
                 {
                     m <<= 1;
                     w >>= 1;
                 }
                 writer.WriteLine("Case " + i + ": " + w + " " + m);
             }
             else
             {
                 writer.WriteLine("Case " + i + ": Impossible");
             }
         }
     }
 }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:26,代码来源:EkkaDokka.cs


示例5: Run

 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int t = fs.NextInt();
         Dictionary<string, int> count = new Dictionary<string, int>();
         while (t-- > 0)
         {
             string[] cmd = fs.ReadLine().Split();
             if (cmd[0] == "+")
             {
                 long a = Convert.ToInt64(cmd[1]);
                 string pattern = NumToPattern(a);
                 if (!count.ContainsKey(pattern)) count.Add(pattern, 0);
                 count[pattern]++;
             }
             else if (cmd[0] == "-")
             {
                 long a = Convert.ToInt64(cmd[1]);
                 string pattern = NumToPattern(a);
                 count[pattern]--;
             }
             else
             {
                 string pattern = AppendZeros(cmd[1]);
                 writer.WriteLine(count.ContainsKey(pattern) ? count[pattern] : 0);
             }
         }
     }
 }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:31,代码来源:SonyaAndQueries371.cs


示例6: Run

 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt();
         int[] indices = new int[n];
         long[] a = new long[n], b = new long[n];
         for (int i = 0; i < n; i++)
         {
             int r = fs.NextInt(), h = fs.NextInt();
             a[i] = (long)r * r * h;
             indices[i] = i;
         }
         Array.Copy(a, b, n);
         Array.Sort(b);
         for (int i = 0; i < n; i++)
         {
             indices[i] = findValue(b, 0, n - 1, a[i]);
         }
         MaxSegmentTree tree = new MaxSegmentTree(new long[n]);
         for (int i = 0; i < n; i++)
         {
             int index = indices[i];
             long value = tree.QueryMax(0, indices[i] - 1) + a[i];
             tree.Update(indices[i], indices[i], value);
         }
         writer.WriteLine((tree.QueryMax(0, n - 1) * Math.PI).ToString().Replace(',', '.'));
     }
 }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:30,代码来源:BabaeiAndBirthdayCake343.cs


示例7: Run

 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt();
         LinkedList<int>[] adjList = new LinkedList<int>[n];
         for (int i = 0; i < n; i++)
         {
             adjList[i] = new LinkedList<int>();
         }
         for (int i = 0; i < n; i++)
         {
             int v = fs.NextInt() - 1;
             if (v != i) adjList[i].AddLast(v);
             if (i > 0)
             {
                 adjList[i].AddLast(i - 1);
                 adjList[i - 1].AddLast(i);
             }
         }
         int[] dist = Enumerable.Repeat(int.MaxValue, n).ToArray();
         RunDijkstra(adjList, dist);
         foreach (int x in dist)
         {
             writer.Write(x + " ");
         }
     }
 }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:29,代码来源:MikeAndShortcuts361.cs


示例8: Run

 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         string str = fs.ReadLine();
         List<int> list = new List<int>(str.Length);
         int first = -1;
         for (int i = 0; i < str.Length; i++)
         {
             if (str[i] == 'F')
             {
                 if (first == -1 && list.Count != i)
                 {
                     first = list.Count;
                 }
                 list.Add(i);
             }
         }
         if (list.Count == 0 || list.Count == str.Length || first == -1)
         {
             writer.WriteLine(0);
             return;
         }
         int t = 0;
         for (int i = first + 1; i < list.Count; i++)
         {
             t = Math.Max(0, t - list[i] + list[i - 1] + 2);
         }
         writer.WriteLine(t + list.Last() - list.Count + 1);
     }
 }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:32,代码来源:Queue205.cs


示例9: Run

        public static void Run()
        {
            using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
            using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
            {
                int n = fs.NextInt(), a = fs.NextInt(), b = fs.NextInt();
                int[] p = new int[n];
                Dictionary<int, int> pos = new Dictionary<int, int>();
                Node[] nodes = new Node[n];
                for (int i = 0; i < n; i++)
                {
                    p[i] = fs.NextInt();
                    nodes[i] = new Node { Value = p[i] };
                    pos.Add(p[i], i);
                }
                for (int i = 0; i < n; i++)
                {
                    int adiff = a - nodes[i].Value;
                    int bdiff = b - nodes[i].Value;
                    if (pos.ContainsKey(adiff))
                    {
                        nodes[i].Adiff = nodes[pos[adiff]];
                        nodes[pos[adiff]].Adiff = nodes[i];
                    }
                    if (pos.ContainsKey(bdiff) && a != b)
                    {
                        nodes[i].Bdiff = nodes[pos[bdiff]];
                        nodes[pos[bdiff]].Bdiff = nodes[i];
                    }
                }

                int[] ans = Enumerable.Repeat(-1, n).ToArray();
                for (int i = 0; i < n; i++)
			    {
                    Node current = nodes[i];
                    if (!Traverse(nodes, current, pos, ans))
                    {
                        writer.WriteLine("NO");
                        return;
                    }
                }
                for (int i = 0; i < n; i++)
                {
                    Node current = nodes[i];
                    if (current.Adiff == current || current.Bdiff == current)
                    {
                        if (current.Adiff == current && current.Bdiff == null) ans[i] = 0;
                        else if (current.Adiff == current && current.Bdiff != null) current.Adiff = null;
                        else if (current.Bdiff == current && current.Adiff == null) ans[i] = 1;
                        else if (current.Bdiff == current && current.Adiff != null) current.Bdiff = null;
                    }
                    Traverse(nodes, current, pos, ans);
                }
                writer.WriteLine("YES");
                for (int i = 0; i < n; i++)
                {
                    writer.Write(ans[i] + " ");
                }
            }
        }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:60,代码来源:TwoSets268.cs


示例10: Run

 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         long x1 = fs.NextInt(), y1 = fs.NextInt();
         long x2 = fs.NextInt(), y2 = fs.NextInt();
         int n = fs.NextInt();
         Line original = new Line 
         { 
             A = y1 - y2, 
             B = x2 - x1, 
             C = x1 * y2 - x2 * y1 
         };
         long minX = Math.Min(x1, x2), maxX = Math.Max(x1, x2);
         long minY = Math.Min(y1, y2), maxY = Math.Max(y1, y2);
         int count = 0;
         for (int i = 0; i < n; i++)
         {
             Line line = new Line { A = fs.NextInt(), B = fs.NextInt(), C = fs.NextInt() };
             double[] cross = GetIntersection(original, line);
             if (cross[0] >= minX && cross[0] <= maxX &&
                 cross[1] >= minY && cross[1] <= maxY) count++;
         }
         writer.WriteLine(count);
     }
 }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:27,代码来源:CrazyTown284.cs


示例11: Run

 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         N = fs.NextInt();
         AdjList = new LinkedList<int>[N];
         for (int i = 0; i < N; i++)
         {
             AdjList[i] = new LinkedList<int>();
         }
         for (int i = 0; i < N - 1; i++)
         {
             int u = fs.NextInt() - 1, v = fs.NextInt() - 1;
             AdjList[u].AddLast(v);
             AdjList[v].AddLast(u);
         }
         int max = 0;
         foreach (int v in AdjList[0])
         {
             List<int> times = new List<int>();
             DFS(times, v, 0, 1);
             int[] temp = times.OrderBy(i => i).ToArray();
             for (int i = 1; i < temp.Length; i++)
             {
                 if (temp[i] <= temp[i - 1]) temp[i] = temp[i - 1] + 1;
             }
             max = Math.Max(max, temp[temp.Length - 1]);
         }
         writer.WriteLine(max);
     }
 }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:32,代码来源:AntsInLeavesECR7.cs


示例12: Run

 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt();
         Segment[] segms = new Segment[n];
         int[] ans = new int[n];
         for (int i = 0; i < n; i++)
         {
             segms[i] = new Segment { Id = i, Left = fs.NextInt(), Right = fs.NextInt() };
         }
         segms = segms.OrderBy(s => s.Left).ToArray();
         Segment[] t = segms.OrderBy(s => s.Right).ToArray();
         int[] ind = new int[n];
         for (int i = 0; i < n; i++)
         {
             ind[i] = findItem(t, 0, n - 1, segms[i].Right);
         }
         SegmentTree tree = new SegmentTree(new int[n]);
         for (int i = n - 1; i >= 0; i--)
         {
             ans[segms[i].Id] = tree.QuerySum(0, ind[i] - 1);
             tree.Update(ind[i], ind[i], 1);
         }
         for (int i = 0; i < n; i++)
         {
             writer.WriteLine(ans[i]);
         }
     }
 }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:31,代码来源:NestedSegmentsECR10.cs


示例13: Run

        public static void Run()
        {
            using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
            using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
            {
                int n = fs.NextInt();
                int[] a = new int[n];
                List<int[]> d = new List<int[]>();
                string s = fs.ReadLine();
                for (int i = 0; i < n; i++)
                {
                    a[i] = int.Parse("" + s[i]);
                    if (i > 0) d.Add(GetDiff(a[i - 1], a[i]));
                }

                for (int i = 0; i < 4; i++)
                {
                    for (int j = 0; j < 3; j++)
                    {
                        if (digits[i, j] == a[0]) continue;
                        if (digits[i, j] != -1 && IsValid(i, j, d))
                        {
                            writer.WriteLine("NO");
                            return;
                        }
                    }
                }
                writer.WriteLine("YES");
            }
        }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:30,代码来源:MikeAndPhone361.cs


示例14: Run

 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt();
         int[] a = new int[n];
         for (int i = 0; i < n; i++)
         {
             a[i] = fs.NextInt();
         }
         for (int i = 0; i < n; i++)
         {
             for (int j = 1; j < n - i; j++)
             {
                 if (a[j] < a[j - 1])
                 {
                     int t = a[j];
                     a[j] = a[j - 1];
                     a[j - 1] = t;
                     writer.WriteLine(j + " " + (j + 1));
                 }
             }
         }
     }
 }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:26,代码来源:GirlsZoo359.cs


示例15: Run

 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt();
         int[] male = new int[367], fem = new int[367];
         for (int i = 0; i < n; i++)
         {
             string[] line = fs.ReadLine().Split(' ');
             if (line[0] == "M")
             {
                 int l = Convert.ToInt32(line[1]), r = Convert.ToInt32(line[2]);
                 for (int j = l; j <= r; j++) male[j]++;
             }
             else if (line[0] == "F")
             {
                 int l = Convert.ToInt32(line[1]), r = Convert.ToInt32(line[2]);
                 for (int j = l; j <= r; j++) fem[j]++;
             }
         }
         int ans = 0;
         for (int i = 1; i < 367; i++)
         {
             ans = Math.Max(ans, Math.Min(male[i], fem[i]) * 2);
         }
         writer.WriteLine(ans);
     }
 }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:29,代码来源:FarRelativesProblem343.cs


示例16: Run

 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt(), m = fs.NextInt();
         int[] a = new int[n];
         int[] accuses = new int[n], defenses = new int[n];
         bool[] isAccusing = new bool[n];
         for (int i = 0; i < n; i++)
         {
             a[i] = fs.NextInt();
             if (a[i] > 0)
             {
                 a[i] = a[i] - 1;
                 accuses[a[i]]++;
                 isAccusing[i] = true;
             }
             else
             {
                 a[i] = -a[i] - 1;
                 defenses[a[i]]++;
                 isAccusing[i] = false;
             }
         }
         bool[] isSuspect = new bool[n];
         int totalAccuses = accuses.Sum(), totalDefenses = defenses.Sum();
         int suspectCount = 0;
         for (int i = 0; i < n; i++)
         {
             if (accuses[i] + (totalDefenses - defenses[i]) == m)
             {
                 isSuspect[i] = true;
                 suspectCount++;
             }
         }
         string[] verdicts = new string[n];
         if (suspectCount == 1)
         {
             for (int i = 0; i < n; i++)
             {
                 if (isAccusing[i] && isSuspect[a[i]] || !isAccusing[i] && !isSuspect[a[i]]) verdicts[i] = "Truth";
                 else verdicts[i] = "Lie";
             }
         }
         else
         {
             for (int i = 0; i < n; i++)
             {
                 if (!isAccusing[i] && !isSuspect[a[i]]) verdicts[i] = "Truth";
                 else if (isAccusing[i] && !isSuspect[a[i]]) verdicts[i] = "Lie";
                 else verdicts[i] = "Not defined";
             }
         }
         for (int i = 0; i < n; i++)
         {
             writer.WriteLine(verdicts[i]);
         }
     }
 }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:60,代码来源:Suspects110.cs


示例17: Run

 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt();
         int[] m = new int[n], r = new int[n];
         for (int i = 0; i < n; i++) m[i] = fs.NextInt();
         for (int i = 0; i < n; i++) r[i] = fs.NextInt();
         int size = (int)1e6;
         bool[] onDuty = new bool[size];
         for (int i = 0; i < size; i++)
         {
             for (int j = 0; j < n; j++)
             {
                 if (i % m[j] == r[j])
                 {
                     onDuty[i] = true;
                     break;
                 }
             }
         }
         int count = 0;
         for (int i = 0; i < size; i++)
         {
             if (onDuty[i]) count++;
         }
         writer.WriteLine(((count * 1.0) / size).ToString().Replace(",", "."));
     }
 }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:30,代码来源:ScrambledB.cs


示例18: Run

 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int t = fs.NextInt();
         for (int i = 1; i <= t; i++)
         {
             long s = fs.NextLong();
             long upper = (long)Math.Ceiling(Math.Sqrt(s));
             long lower = upper - 1;
             long lt = s - lower * lower, x, y;
             if ((upper & 1) == 0)
             {
                 x = Math.Min(upper, lt);
                 y = upper - (lt > upper ? (lt - upper) : 0);
             }
             else
             {
                 x = upper - (lt > upper ? (lt - upper) : 0);
                 y = Math.Min(upper, lt);
             }
             writer.WriteLine("Case " + i + ": " + x + " " + y);
         }
     }
 }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:26,代码来源:FibsievesFantabulousBirthday.cs


示例19: Run

        public static void Run()
        {
            using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
            using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
            {
                int n = fs.NextInt(), m = fs.NextInt();
                int[] p = new int[n];
                DisjointSet dsu = new DisjointSet();
                for (int i = 0; i < n; i++)
                {
                    p[i] = fs.NextInt() - 1;
                    dsu.MakeSet(i);
                }
                for (int i = 0; i < m; i++)
                {
                    int u = fs.NextInt() - 1, v = fs.NextInt() - 1;
                    dsu.Union(p[u], p[v]);
                }

                LinkedList<int>[] lists = new LinkedList<int>[n];
                for (int i = n - 1; i >= 0; i--)
                {
                    int set = dsu.FindSet(i);
                    if (lists[set] == null) lists[set] = new LinkedList<int>();
                    lists[set].AddLast(i);
                }
                for (int i = 0; i < n; i++)
                {
                    int set = dsu.FindSet(p[i]);
                    writer.Write(lists[set].First() + 1 + " ");
                    lists[set].RemoveFirst();
                }
            }
        }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:34,代码来源:SwapsInPermutationECR14.cs


示例20: Run

 public static void Run()
 {
     using (FastScanner reader = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = reader.NextInt(), m = reader.NextInt();
         int[] a = new int[n], count = new int[n];
         for (int i = 0; i < n; i++)
         {
             a[i] = reader.NextInt();
         }
         count[n - 1] = 1;
         for (int i = n - 2; i >= 0; i--)
         {
             if (a[i] == a[i + 1]) count[i] = count[i + 1] + 1;
             else count[i] = 1;
         }
         while (m-- > 0)
         {
             int l = reader.NextInt() - 1, r = reader.NextInt() - 1, x = reader.NextInt(), t = l;
             if (a[l] == x) t = l + count[l];
             if (t > r) writer.WriteLine(-1);
             else writer.WriteLine(t + 1);
         }
     }
 }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:26,代码来源:NotEqualOnSegmentECR7.cs



注:本文中的CFTraining.Helpers.FastScanner类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Rpc.Client类代码示例发布时间:2022-05-24
下一篇:
C# CommonLibrary.DataConnection类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap