結果

問題 No.810 割った余りの個数
ユーザー Tomohiko HasegawaTomohiko Hasegawa
提出日時 2019-04-13 15:26:45
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 1,395 bytes
コンパイル時間 843 ms
コンパイル使用メモリ 65,540 KB
実行使用メモリ 22,868 KB
最終ジャッジ日時 2023-10-13 14:21:49
合計ジャッジ時間 3,832 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,708 KB
testcase_01 AC 57 ms
20,764 KB
testcase_02 AC 59 ms
20,828 KB
testcase_03 AC 58 ms
20,732 KB
testcase_04 AC 58 ms
22,776 KB
testcase_05 AC 57 ms
22,728 KB
testcase_06 AC 57 ms
22,760 KB
testcase_07 AC 58 ms
20,764 KB
testcase_08 AC 57 ms
20,680 KB
testcase_09 AC 58 ms
18,824 KB
testcase_10 AC 58 ms
20,628 KB
testcase_11 AC 58 ms
20,776 KB
testcase_12 AC 58 ms
22,868 KB
testcase_13 AC 58 ms
20,696 KB
testcase_14 AC 57 ms
20,732 KB
testcase_15 AC 57 ms
20,752 KB
testcase_16 AC 58 ms
22,756 KB
testcase_17 AC 58 ms
20,628 KB
testcase_18 AC 56 ms
18,628 KB
testcase_19 AC 58 ms
22,768 KB
testcase_20 AC 57 ms
20,688 KB
testcase_21 AC 56 ms
20,680 KB
testcase_22 AC 57 ms
22,708 KB
testcase_23 AC 58 ms
20,740 KB
testcase_24 AC 57 ms
20,736 KB
testcase_25 AC 57 ms
20,860 KB
testcase_26 AC 57 ms
20,688 KB
testcase_27 AC 57 ms
20,816 KB
testcase_28 AC 58 ms
22,760 KB
testcase_29 AC 59 ms
20,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.yukicoder
{
    class _810
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            int[] lrm = ReadInts();
            int l = lrm[0];
            int r = lrm[1];
            int m = lrm[2];
            if (r - l >= m) WriteLine(m);
            else
            {
                int ll = l % m;
                int rr = r % m;
                if (ll <= rr) WriteLine(rr - ll + 1);
                else WriteLine(rr + m - ll + 1);
            }
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}
0