結果
問題 |
No.129 お年玉(2)
|
ユーザー |
![]() |
提出日時 | 2016-10-10 17:59:05 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 608 bytes |
コンパイル時間 | 303 ms |
コンパイル使用メモリ | 31,104 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-11-22 00:57:32 |
合計ジャッジ時間 | 254,453 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 TLE * 41 |
ソースコード
program main implicit none integer*8::N,M,amari integer*8,parameter::sen=1000 read *,N,M N = N/sen amari = MOD(N, M) print '(i0)', get_combination(M, MIN(amari, M-amari)) contains recursive function get_combination(N,R) result(NCR) integer*8::N,R,NCR integer*8,parameter::modular=10**9 if(R.eq.0) then NCR = 1 else if(R.eq.1) then NCR = N else if(N-R.lt.R) then NCR = get_combination(N, N-R) else NCR = get_combination(N-1,R) + get_combination(N-1,R-1) end if NCR = MOD(NCR, modular) end function get_combination end program main