結果

問題 No.810 割った余りの個数
ユーザー Tomohiko Hasegawa
提出日時 2019-04-13 15:25:17
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,394 bytes
コンパイル時間 5,052 ms
コンパイル使用メモリ 104,704 KB
実行使用メモリ 17,920 KB
最終ジャッジ日時 2024-09-15 11:08:41
合計ジャッジ時間 2,707 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

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