結果
問題 |
No.129 お年玉(2)
|
ユーザー |
|
提出日時 | 2016-05-04 11:05:14 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 669 bytes |
コンパイル時間 | 2,314 ms |
コンパイル使用メモリ | 74,224 KB |
実行使用メモリ | 52,224 KB |
最終ジャッジ日時 | 2024-10-05 06:18:10 |
合計ジャッジ時間 | 8,532 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 3 WA * 1 RE * 42 |
ソースコード
package yukicoder; import java.util.Scanner; public class Main{ public static void main(String[] args)throws Exception{ new Main().solve(); } final int mod=1_000_000_000; void solve(){ Scanner sc=new Scanner(System.in); long n=sc.nextLong(); int m=sc.nextInt(); n=n%(m*1000); n=n/1000; long ans=nCk(m,(int)n); //n個の●をm人に配分する。 System.out.println(ans); } long[] fact; long[] inv_fact; //1~nの数字からk個取る方法の数 long nCk(int n,int k){ if(n<k)return 0; else{ return ((fact(n)/(fact(n-k))/fact(k)))%mod; } } long fact(int n){ long ans=1; for(int i=1;i<=n;i++)ans*=i; return ans; } }