結果

問題 No.810 割った余りの個数
ユーザー tentententen
提出日時 2020-09-01 07:25:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 352 bytes
コンパイル時間 2,069 ms
コンパイル使用メモリ 75,116 KB
実行使用メモリ 41,492 KB
最終ジャッジ日時 2024-04-28 20:00:49
合計ジャッジ時間 7,164 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
41,268 KB
testcase_01 AC 131 ms
40,812 KB
testcase_02 AC 132 ms
41,020 KB
testcase_03 AC 131 ms
40,956 KB
testcase_04 AC 132 ms
41,308 KB
testcase_05 AC 130 ms
41,224 KB
testcase_06 AC 131 ms
41,404 KB
testcase_07 AC 129 ms
41,056 KB
testcase_08 AC 130 ms
41,280 KB
testcase_09 AC 129 ms
41,160 KB
testcase_10 AC 131 ms
41,492 KB
testcase_11 AC 133 ms
40,780 KB
testcase_12 AC 118 ms
40,560 KB
testcase_13 AC 128 ms
41,304 KB
testcase_14 AC 132 ms
41,144 KB
testcase_15 AC 131 ms
41,020 KB
testcase_16 AC 131 ms
41,224 KB
testcase_17 AC 119 ms
40,392 KB
testcase_18 AC 119 ms
39,968 KB
testcase_19 AC 131 ms
41,084 KB
testcase_20 AC 135 ms
41,120 KB
testcase_21 AC 133 ms
41,140 KB
testcase_22 AC 131 ms
41,392 KB
testcase_23 AC 131 ms
41,376 KB
testcase_24 AC 129 ms
41,292 KB
testcase_25 AC 132 ms
41,316 KB
testcase_26 AC 132 ms
41,100 KB
testcase_27 AC 120 ms
40,100 KB
testcase_28 AC 130 ms
41,384 KB
testcase_29 AC 119 ms
40,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int a = sc.nextInt();
    	int b = sc.nextInt();
    	int c = sc.nextInt();
    	if (b - a + 1 >= c) {
    	    System.out.println(c);
    	} else {
    	    System.out.println((b % c - (a - 1) % c + c) % c);
    	}
	}
}
0