コード例 #1
0
ファイル: A.cs プロジェクト: ailyanlu1/ACM-ICPC-4
        static void Main(string[] args)
        {
            long a = Cin.NextInt();
            long b = Cin.NextInt();

            Console.WriteLine(((a + b) / b) * b);
        }
コード例 #2
0
        static void Main(String[] args)
        {
            int n = Cin.NextInt();
            int k = Cin.NextInt();

            int[] t = new int[n];

            for (int i = 0; i < n; i++)
            {
                t[i] = Cin.NextInt();
            }

            int a   = 0;
            int ans = 0;

            for (int i = 0; i < n; i++)
            {
                for (int j = 1; j <= t[i]; j++)
                {
                    int pp = a + (j + k - 1) / k;
                    if (pp == j)
                    {
                        ans++;
                    }
                }
                a += (t[i] + k - 1) / k;
            }
            Cout.Print(ans);
        }
コード例 #3
0
        static void Main(String[] args)
        {
            int n = Cin.NextInt();
            int k = Cin.NextInt();
            int q = Cin.NextInt();

            int[] ns = new int[n];
            for (int i = 0; i < n; i++)
            {
                ns[i] = Cin.NextInt();
            }

            k %= n;
            var res = ns;

            if (k != 0)
            {
                var l = ns.ToList().GetRange(0, n - k).ToArray();
                var r = ns.ToList().GetRange(n - k, k).ToArray();
                res = r.Concat(l).ToArray();
            }

            for (int i = 0; i < q; i++)
            {
                int Q = Cin.NextInt();
                Cout.Print(res[Q]);
            }
        }
コード例 #4
0
        static void Main(String[] args)
        {
            int T = Cin.NextInt();

            for (int case_ = 0; case_ < T; case_++)
            {
                int   n  = Cin.NextInt();
                int[] ns = new int[n];
                for (int i = 0; i < n; i++)
                {
                    ns[i] = Cin.NextInt();
                }
                int s = 0;
                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < i; j++)
                    {
                        if (ns[j] > ns[i])
                        {
                            s++;
                        }
                    }
                }
                Cout.Print(s % 2 == 1? "NO": "YES");
            }
        }
コード例 #5
0
        static void Main(String[] args)
        {
            r = Cin.NextInt();
            c = Cin.NextInt();
            int n = Cin.NextInt();

            int[,] board = new int[r, c];
            for (int i = 0; i < r; i++)
            {
                var line = Cin.NextToken();
                for (int j = 0; j < c; j++)
                {
                    if (line[j] == '.')
                    {
                        board[i, j] = 0;
                    }
                    else
                    {
                        board[i, j] = 4;
                    }
                }
            }

            int[,,] buffer = new int[r, c, 2];
            for (int i = 0; i < r; i++)
            {
                for (int j = 0; j < c; j++)
                {
                    buffer[i, j, 0] = board[i, j];
                }
            }


            n = (n - 2) % 4 + 2;
            int p = tick(buffer, 0, n);

            for (int i = 0; i < r; i++)
            {
                for (int j = 0; j < c; j++)
                {
                    Cout.Write(buffer[i, j, p] == 0? '.': 'O');
                }
                Cout.Print("");
            }
        }
コード例 #6
0
ファイル: B.cs プロジェクト: ailyanlu1/ACM-ICPC-4
        static void Main(string[] args)
        {
            int a = Cin.NextInt();
            int b = a / 4000 * 4000;

            a %= 4000;

            for (int i = a + 1; /* pass */; i++)
            {
                var d1 = DateTime.Parse(string.Format("{0}-01-01", a));
                var d2 = DateTime.Parse(string.Format("{0}-01-01", i));

                var  diff = d2 - d1;
                bool ly   = !(isLeapYear(a) ^ isLeapYear(i));
                bool wd   = diff.Days % 7 == 0;

                if (ly && wd)
                {
                    Console.WriteLine(i + b);
                    break;
                }
            }
        }