結果

問題 No.129 お年玉(2)
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-16 11:12:47
言語 Java19
(openjdk 21)
結果
AC  
実行時間 671 ms / 5,000 ms
コード長 735 bytes
コンパイル時間 3,898 ms
コンパイル使用メモリ 71,360 KB
実行使用メモリ 60,288 KB
最終ジャッジ日時 2023-08-18 17:57:21
合計ジャッジ時間 24,865 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 204 ms
59,012 KB
testcase_01 AC 671 ms
59,580 KB
testcase_02 AC 107 ms
55,924 KB
testcase_03 AC 107 ms
55,724 KB
testcase_04 AC 105 ms
55,632 KB
testcase_05 AC 403 ms
59,664 KB
testcase_06 AC 509 ms
59,904 KB
testcase_07 AC 560 ms
59,736 KB
testcase_08 AC 466 ms
59,584 KB
testcase_09 AC 544 ms
60,024 KB
testcase_10 AC 570 ms
59,692 KB
testcase_11 AC 458 ms
59,804 KB
testcase_12 AC 531 ms
59,688 KB
testcase_13 AC 542 ms
59,728 KB
testcase_14 AC 534 ms
59,812 KB
testcase_15 AC 484 ms
59,768 KB
testcase_16 AC 509 ms
59,704 KB
testcase_17 AC 571 ms
58,064 KB
testcase_18 AC 541 ms
59,612 KB
testcase_19 AC 559 ms
59,676 KB
testcase_20 AC 576 ms
59,884 KB
testcase_21 AC 651 ms
59,564 KB
testcase_22 AC 479 ms
59,556 KB
testcase_23 AC 581 ms
59,572 KB
testcase_24 AC 566 ms
59,796 KB
testcase_25 AC 455 ms
59,984 KB
testcase_26 AC 471 ms
59,988 KB
testcase_27 AC 461 ms
60,088 KB
testcase_28 AC 650 ms
59,680 KB
testcase_29 AC 108 ms
55,600 KB
testcase_30 AC 106 ms
55,940 KB
testcase_31 AC 110 ms
55,932 KB
testcase_32 AC 109 ms
55,928 KB
testcase_33 AC 153 ms
58,372 KB
testcase_34 AC 120 ms
56,056 KB
testcase_35 AC 138 ms
57,960 KB
testcase_36 AC 150 ms
57,776 KB
testcase_37 AC 154 ms
58,436 KB
testcase_38 AC 244 ms
59,344 KB
testcase_39 AC 289 ms
59,724 KB
testcase_40 AC 469 ms
59,528 KB
testcase_41 AC 373 ms
59,872 KB
testcase_42 AC 251 ms
59,628 KB
testcase_43 AC 252 ms
59,496 KB
testcase_44 AC 646 ms
60,288 KB
testcase_45 AC 201 ms
58,576 KB
testcase_46 AC 289 ms
59,696 KB
testcase_47 AC 628 ms
59,768 KB
testcase_48 AC 482 ms
59,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long M = sc.nextLong();
    N /= 1000;
    long r = N % M;
    BigInteger p1 = new BigInteger("1");
    for(int i = 2; i <= M; i++) {
      BigInteger p = new BigInteger(String.valueOf(i));
      p1 = p1.multiply(p);
    }
    for(int i = 2; i <= r; i++) {
      BigInteger p = new BigInteger(String.valueOf(i));
      p1 = p1.divide(p);
    }
    for(int i = 2; i <= M - r; i++) {
      BigInteger p = new BigInteger(String.valueOf(i));
      p1 = p1.divide(p);
    }
    p1 = p1.mod(new BigInteger("1000000000"));
    System.out.println(p1);
  }
}
0