結果

問題 No.1663 Maximum Remainder
ユーザー bluemeganebluemegane
提出日時 2021-09-03 22:11:16
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 618 bytes
コンパイル時間 961 ms
コンパイル使用メモリ 67,124 KB
実行使用メモリ 22,816 KB
最終ジャッジ日時 2023-08-21 22:07:15
合計ジャッジ時間 2,518 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
20,644 KB
testcase_01 AC 59 ms
20,800 KB
testcase_02 AC 56 ms
20,720 KB
testcase_03 AC 56 ms
20,772 KB
testcase_04 AC 56 ms
22,656 KB
testcase_05 AC 56 ms
22,744 KB
testcase_06 AC 57 ms
22,816 KB
testcase_07 AC 58 ms
22,708 KB
testcase_08 AC 56 ms
18,568 KB
testcase_09 AC 55 ms
20,816 KB
testcase_10 AC 57 ms
20,748 KB
testcase_11 AC 57 ms
18,624 KB
testcase_12 AC 57 ms
20,772 KB
testcase_13 AC 56 ms
20,632 KB
testcase_14 AC 56 ms
20,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using static System.Math;
using System;

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = int.Parse(line[0]);
        var b = int.Parse(line[1]);
        var c = int.Parse(line[2]);
        var d = int.Parse(line[3]);
        var m = int.Parse(line[4]);
        getAns(a, b, c, d, m);
    }
    static void getAns(int a, int b, int c, int d, int m)
    {
        var ans = 0;
        for (int i = a; i <= b; i++)
            for (int j = c; j <= d; j++)
                ans = Max(ans, (i + j) % m);
        Console.WriteLine(ans);
    }
}
0