結果

問題 No.129 お年玉(2)
ユーザー chocoruskchocorusk
提出日時 2020-10-03 12:35:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 385 ms / 5,000 ms
コード長 548 bytes
コンパイル時間 2,078 ms
コンパイル使用メモリ 71,852 KB
実行使用メモリ 57,724 KB
最終ジャッジ日時 2023-09-25 05:03:56
合計ジャッジ時間 15,835 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
55,340 KB
testcase_01 AC 385 ms
56,172 KB
testcase_02 AC 116 ms
55,344 KB
testcase_03 AC 116 ms
55,652 KB
testcase_04 AC 116 ms
56,148 KB
testcase_05 AC 228 ms
55,700 KB
testcase_06 AC 293 ms
56,036 KB
testcase_07 AC 334 ms
56,404 KB
testcase_08 AC 265 ms
55,660 KB
testcase_09 AC 314 ms
55,892 KB
testcase_10 AC 338 ms
55,720 KB
testcase_11 AC 259 ms
55,880 KB
testcase_12 AC 300 ms
55,396 KB
testcase_13 AC 309 ms
56,100 KB
testcase_14 AC 303 ms
55,884 KB
testcase_15 AC 270 ms
56,396 KB
testcase_16 AC 292 ms
55,868 KB
testcase_17 AC 328 ms
55,452 KB
testcase_18 AC 316 ms
56,264 KB
testcase_19 AC 330 ms
56,176 KB
testcase_20 AC 330 ms
55,644 KB
testcase_21 AC 378 ms
55,796 KB
testcase_22 AC 270 ms
56,088 KB
testcase_23 AC 348 ms
55,648 KB
testcase_24 AC 337 ms
55,556 KB
testcase_25 AC 259 ms
55,840 KB
testcase_26 AC 264 ms
56,188 KB
testcase_27 AC 254 ms
55,400 KB
testcase_28 AC 382 ms
55,280 KB
testcase_29 AC 119 ms
56,072 KB
testcase_30 AC 116 ms
55,732 KB
testcase_31 AC 120 ms
56,092 KB
testcase_32 AC 119 ms
55,824 KB
testcase_33 AC 128 ms
57,724 KB
testcase_34 AC 122 ms
56,084 KB
testcase_35 AC 125 ms
55,656 KB
testcase_36 AC 125 ms
55,676 KB
testcase_37 AC 124 ms
55,852 KB
testcase_38 AC 151 ms
55,948 KB
testcase_39 AC 166 ms
55,820 KB
testcase_40 AC 249 ms
55,972 KB
testcase_41 AC 200 ms
56,100 KB
testcase_42 AC 156 ms
55,900 KB
testcase_43 AC 158 ms
56,020 KB
testcase_44 AC 382 ms
56,204 KB
testcase_45 AC 145 ms
55,420 KB
testcase_46 AC 174 ms
55,444 KB
testcase_47 AC 376 ms
55,740 KB
testcase_48 AC 272 ms
56,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		long n=Long.parseLong(scanner.next());
		int m=Integer.parseInt(scanner.next());
		int x=(int)(n/1000%m);
		final int MOD=1000000000;
		int[] c=new int[m+1];
		c[0]=1;
		for(int i=0; i<m; i++) {
			for(int j=i+1; j>=1; j--) {
				c[j]+=c[j-1];
				if(c[j]>=MOD) c[j]-=MOD;
			}
		}
		out.println(c[x]);
		out.close();
		scanner.close();
	}
}
0