結果
問題 | No.129 お年玉(2) |
ユーザー |
![]() |
提出日時 | 2017-06-16 11:12:47 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 767 ms / 5,000 ms |
コード長 | 735 bytes |
コンパイル時間 | 1,801 ms |
コンパイル使用メモリ | 74,644 KB |
実行使用メモリ | 47,404 KB |
最終ジャッジ日時 | 2024-11-28 00:53:38 |
合計ジャッジ時間 | 24,491 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
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);}}