結果

問題 No.129 お年玉(2)
ユーザー kou6839kou6839
提出日時 2015-01-21 23:51:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 295 ms / 5,000 ms
コード長 645 bytes
コンパイル時間 2,904 ms
コンパイル使用メモリ 76,388 KB
実行使用メモリ 60,384 KB
最終ジャッジ日時 2023-08-18 16:58:10
合計ジャッジ時間 13,655 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
56,332 KB
testcase_01 AC 295 ms
60,288 KB
testcase_02 AC 112 ms
55,888 KB
testcase_03 AC 116 ms
58,248 KB
testcase_04 AC 111 ms
56,376 KB
testcase_05 AC 218 ms
58,944 KB
testcase_06 AC 193 ms
58,536 KB
testcase_07 AC 228 ms
60,384 KB
testcase_08 AC 221 ms
59,168 KB
testcase_09 AC 191 ms
58,784 KB
testcase_10 AC 252 ms
59,236 KB
testcase_11 AC 207 ms
59,136 KB
testcase_12 AC 142 ms
56,580 KB
testcase_13 AC 128 ms
56,180 KB
testcase_14 AC 205 ms
58,580 KB
testcase_15 AC 198 ms
58,404 KB
testcase_16 AC 219 ms
58,748 KB
testcase_17 AC 187 ms
59,152 KB
testcase_18 AC 236 ms
59,196 KB
testcase_19 AC 258 ms
59,480 KB
testcase_20 AC 215 ms
58,948 KB
testcase_21 AC 193 ms
59,176 KB
testcase_22 AC 218 ms
58,716 KB
testcase_23 AC 258 ms
58,936 KB
testcase_24 AC 270 ms
59,560 KB
testcase_25 AC 207 ms
58,384 KB
testcase_26 AC 216 ms
59,000 KB
testcase_27 AC 228 ms
59,164 KB
testcase_28 AC 224 ms
58,676 KB
testcase_29 AC 113 ms
56,452 KB
testcase_30 AC 119 ms
56,220 KB
testcase_31 AC 114 ms
56,424 KB
testcase_32 AC 117 ms
56,268 KB
testcase_33 AC 113 ms
56,508 KB
testcase_34 AC 127 ms
56,392 KB
testcase_35 AC 122 ms
56,432 KB
testcase_36 AC 135 ms
56,604 KB
testcase_37 AC 123 ms
56,504 KB
testcase_38 AC 155 ms
58,436 KB
testcase_39 AC 163 ms
56,764 KB
testcase_40 AC 179 ms
58,776 KB
testcase_41 AC 194 ms
58,780 KB
testcase_42 AC 171 ms
58,344 KB
testcase_43 AC 137 ms
56,364 KB
testcase_44 AC 282 ms
59,728 KB
testcase_45 AC 175 ms
58,436 KB
testcase_46 AC 134 ms
56,124 KB
testcase_47 AC 260 ms
59,764 KB
testcase_48 AC 229 ms
59,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;

class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        int m = sc.nextInt();
        long nokori = n/1000*1000-n/1000/m*1000*m;
        nokori/=1000;
        long ans = 1;
        BigInteger bigInteger = new BigInteger("1");
        for(int i=0;i<(int)nokori;i++){
        	bigInteger=bigInteger.multiply(new BigInteger(""+m).subtract(new BigInteger(""+i)));
        	bigInteger=bigInteger.divide(new BigInteger(""+(i+1)));
        }
        System.out.println(bigInteger.mod(new BigInteger("1000000000")));       
	}
}
0