結果

問題 No.129 お年玉(2)
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-20 17:09:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 251 ms / 5,000 ms
コード長 612 bytes
コンパイル時間 3,057 ms
コンパイル使用メモリ 72,528 KB
実行使用メモリ 60,404 KB
最終ジャッジ日時 2023-08-18 17:43:45
合計ジャッジ時間 13,079 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
56,068 KB
testcase_01 AC 251 ms
58,892 KB
testcase_02 AC 108 ms
55,572 KB
testcase_03 AC 113 ms
56,508 KB
testcase_04 AC 113 ms
56,524 KB
testcase_05 AC 208 ms
59,668 KB
testcase_06 AC 179 ms
58,632 KB
testcase_07 AC 203 ms
58,700 KB
testcase_08 AC 213 ms
59,048 KB
testcase_09 AC 179 ms
58,660 KB
testcase_10 AC 233 ms
59,136 KB
testcase_11 AC 190 ms
58,412 KB
testcase_12 AC 124 ms
56,620 KB
testcase_13 AC 120 ms
56,784 KB
testcase_14 AC 182 ms
58,860 KB
testcase_15 AC 175 ms
58,716 KB
testcase_16 AC 200 ms
58,932 KB
testcase_17 AC 170 ms
59,092 KB
testcase_18 AC 211 ms
58,480 KB
testcase_19 AC 242 ms
58,804 KB
testcase_20 AC 193 ms
59,048 KB
testcase_21 AC 169 ms
58,632 KB
testcase_22 AC 189 ms
58,376 KB
testcase_23 AC 225 ms
58,716 KB
testcase_24 AC 241 ms
58,720 KB
testcase_25 AC 179 ms
56,472 KB
testcase_26 AC 200 ms
58,824 KB
testcase_27 AC 205 ms
58,900 KB
testcase_28 AC 199 ms
59,072 KB
testcase_29 AC 109 ms
56,208 KB
testcase_30 AC 111 ms
56,016 KB
testcase_31 AC 110 ms
56,088 KB
testcase_32 AC 115 ms
55,980 KB
testcase_33 AC 119 ms
56,164 KB
testcase_34 AC 115 ms
56,124 KB
testcase_35 AC 112 ms
56,224 KB
testcase_36 AC 122 ms
56,092 KB
testcase_37 AC 110 ms
56,112 KB
testcase_38 AC 141 ms
56,344 KB
testcase_39 AC 144 ms
60,404 KB
testcase_40 AC 154 ms
58,632 KB
testcase_41 AC 164 ms
58,660 KB
testcase_42 AC 150 ms
58,672 KB
testcase_43 AC 121 ms
56,400 KB
testcase_44 AC 246 ms
59,396 KB
testcase_45 AC 143 ms
58,336 KB
testcase_46 AC 121 ms
55,972 KB
testcase_47 AC 227 ms
58,400 KB
testcase_48 AC 196 ms
58,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Exercise100{
  public static void main (String[] args){

    Scanner sc = new Scanner(System.in);

    long n = sc.nextLong();
    long m = sc.nextLong();

    long mod = 1000000000;

    if((n / 1000) % m == 0){
      System.out.println(1);
    }else{
      long bills = ((n / 1000) % m);
      BigInteger a = BigInteger.ONE;
      for(long i = 0; i < bills; i++){
        a = a.multiply(BigInteger.valueOf(m - i));
        a = a.divide(BigInteger.valueOf(i + 1));
      }
      System.out.println(a.remainder(BigInteger.valueOf(mod)));
    }
  }
}
0