結果

問題 No.129 お年玉(2)
ユーザー kou6839kou6839
提出日時 2015-01-21 23:51:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 284 ms / 5,000 ms
コード長 645 bytes
コンパイル時間 3,801 ms
コンパイル使用メモリ 86,816 KB
実行使用メモリ 47,108 KB
最終ジャッジ日時 2024-05-05 22:12:46
合計ジャッジ時間 14,293 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 147 ms
42,188 KB
testcase_01 AC 284 ms
47,108 KB
testcase_02 AC 114 ms
41,556 KB
testcase_03 AC 113 ms
40,732 KB
testcase_04 AC 119 ms
41,016 KB
testcase_05 AC 233 ms
45,636 KB
testcase_06 AC 213 ms
45,820 KB
testcase_07 AC 233 ms
45,380 KB
testcase_08 AC 245 ms
45,588 KB
testcase_09 AC 175 ms
45,228 KB
testcase_10 AC 259 ms
46,100 KB
testcase_11 AC 233 ms
45,868 KB
testcase_12 AC 132 ms
42,008 KB
testcase_13 AC 129 ms
41,260 KB
testcase_14 AC 190 ms
45,704 KB
testcase_15 AC 199 ms
45,536 KB
testcase_16 AC 215 ms
45,500 KB
testcase_17 AC 186 ms
45,304 KB
testcase_18 AC 232 ms
45,988 KB
testcase_19 AC 248 ms
46,776 KB
testcase_20 AC 228 ms
45,512 KB
testcase_21 AC 192 ms
45,152 KB
testcase_22 AC 219 ms
45,236 KB
testcase_23 AC 240 ms
46,024 KB
testcase_24 AC 278 ms
46,760 KB
testcase_25 AC 208 ms
45,612 KB
testcase_26 AC 220 ms
45,468 KB
testcase_27 AC 227 ms
45,560 KB
testcase_28 AC 233 ms
45,484 KB
testcase_29 AC 113 ms
41,368 KB
testcase_30 AC 112 ms
40,960 KB
testcase_31 AC 125 ms
41,404 KB
testcase_32 AC 129 ms
41,264 KB
testcase_33 AC 115 ms
41,004 KB
testcase_34 AC 146 ms
41,576 KB
testcase_35 AC 114 ms
40,120 KB
testcase_36 AC 141 ms
41,280 KB
testcase_37 AC 140 ms
41,248 KB
testcase_38 AC 172 ms
43,636 KB
testcase_39 AC 159 ms
43,292 KB
testcase_40 AC 185 ms
45,168 KB
testcase_41 AC 198 ms
45,468 KB
testcase_42 AC 179 ms
45,412 KB
testcase_43 AC 142 ms
41,128 KB
testcase_44 AC 277 ms
46,956 KB
testcase_45 AC 180 ms
43,748 KB
testcase_46 AC 150 ms
42,216 KB
testcase_47 AC 261 ms
46,668 KB
testcase_48 AC 236 ms
45,924 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