結果
問題 |
No.129 お年玉(2)
|
ユーザー |
|
提出日時 | 2016-09-20 08:04:30 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 423 bytes |
コンパイル時間 | 442 ms |
コンパイル使用メモリ | 55,096 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-17 10:05:51 |
合計ジャッジ時間 | 6,541 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 4 WA * 2 RE * 40 |
ソースコード
#include <iostream> using namespace std; typedef long long ll; const int mod=1e9; int main(){ ll N,M; cin>>N; cin>>M; ll D=N%(1000*M); D/=1e3; if(D==0){ cout<<1<<endl; } else { ll E=1; for(int i=M; i>M-D; --i){ E%=mod; i%=mod; E*=i; } ll F=1; for(int i=D; i>=1; --i){ F%=mod; i%=mod; F*=i; } E%=mod; F%=mod; ll G=E/F; G%=mod; cout<<G<<endl; } return 0; }