結果

問題 No.129 お年玉(2)
ユーザー chocoruskchocorusk
提出日時 2020-10-03 12:32:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 490 ms / 5,000 ms
コード長 634 bytes
コンパイル時間 2,240 ms
コンパイル使用メモリ 72,032 KB
実行使用メモリ 58,772 KB
最終ジャッジ日時 2023-09-25 05:03:40
合計ジャッジ時間 19,964 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 150 ms
57,752 KB
testcase_01 AC 490 ms
58,264 KB
testcase_02 AC 116 ms
56,456 KB
testcase_03 AC 115 ms
55,832 KB
testcase_04 AC 117 ms
55,904 KB
testcase_05 AC 285 ms
58,048 KB
testcase_06 AC 366 ms
58,488 KB
testcase_07 AC 419 ms
58,128 KB
testcase_08 AC 330 ms
58,132 KB
testcase_09 AC 400 ms
58,104 KB
testcase_10 AC 431 ms
58,332 KB
testcase_11 AC 318 ms
58,200 KB
testcase_12 AC 376 ms
58,488 KB
testcase_13 AC 382 ms
56,180 KB
testcase_14 AC 383 ms
57,864 KB
testcase_15 AC 337 ms
58,356 KB
testcase_16 AC 361 ms
58,032 KB
testcase_17 AC 421 ms
58,320 KB
testcase_18 AC 399 ms
57,860 KB
testcase_19 AC 412 ms
58,568 KB
testcase_20 AC 412 ms
58,128 KB
testcase_21 AC 482 ms
58,108 KB
testcase_22 AC 329 ms
58,772 KB
testcase_23 AC 435 ms
58,012 KB
testcase_24 AC 431 ms
58,456 KB
testcase_25 AC 319 ms
58,372 KB
testcase_26 AC 323 ms
58,204 KB
testcase_27 AC 318 ms
58,276 KB
testcase_28 AC 485 ms
58,292 KB
testcase_29 AC 117 ms
55,596 KB
testcase_30 AC 117 ms
56,180 KB
testcase_31 AC 115 ms
53,280 KB
testcase_32 AC 115 ms
55,996 KB
testcase_33 AC 128 ms
58,180 KB
testcase_34 AC 122 ms
55,912 KB
testcase_35 AC 132 ms
56,160 KB
testcase_36 AC 133 ms
58,264 KB
testcase_37 AC 134 ms
57,392 KB
testcase_38 AC 174 ms
58,200 KB
testcase_39 AC 193 ms
58,532 KB
testcase_40 AC 310 ms
58,540 KB
testcase_41 AC 241 ms
58,088 KB
testcase_42 AC 179 ms
58,072 KB
testcase_43 AC 175 ms
58,360 KB
testcase_44 AC 483 ms
57,804 KB
testcase_45 AC 157 ms
57,796 KB
testcase_46 AC 200 ms
58,008 KB
testcase_47 AC 474 ms
58,564 KB
testcase_48 AC 338 ms
58,708 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[1];
		c[0]=1;
		for(int i=0; i<m; i++) {
			int[] nc=new int[i+2];
			for(int j=0; j<=i; j++) {
				nc[j]+=c[j];
				if(nc[j]>=MOD) nc[j]-=MOD;
				nc[j+1]+=c[j];
				if(nc[j+1]>=MOD) nc[j+1]-=MOD;
			}
			c=nc;
		}
		out.println(c[x]);
		out.close();
		scanner.close();
	}
}
0