結果
問題 |
No.129 お年玉(2)
|
ユーザー |
![]() |
提出日時 | 2015-01-17 00:16:32 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 520 bytes |
コンパイル時間 | 439 ms |
コンパイル使用メモリ | 55,464 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-22 13:15:03 |
合計ジャッジ時間 | 1,823 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 WA * 41 |
ソースコード
#include <iostream> using namespace std; typedef long long LL; const LL b = 1000000000; int main() { cin.tie(0); ios::sync_with_stdio(false); LL n; int m; cin >> n >> m; int a = n / 1000 % m; if(a == 0) cout << 1 << endl; else{ int ans = 1; if(a < m - a){ for(int i = 0; i != a; ++i){ ans *= m - i; ans /= a - i; ans %= b; } } else{ for(int i = 0; i != m - a; ++i){ ans *= m - i; ans /= (m - a) - i; ans %= b; } } cout << ans << endl; } return 0; }