結果
問題 |
No.129 お年玉(2)
|
ユーザー |
|
提出日時 | 2015-01-16 23:53:12 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 649 bytes |
コンパイル時間 | 657 ms |
コンパイル使用メモリ | 62,440 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-22 12:53:22 |
合計ジャッジ時間 | 3,505 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 40 |
ソースコード
#include <iostream> #include <cstdio> #include <algorithm> #include <vector> using namespace std; const int mod = 1000000000; int main() { long long n, m; cin >> n >> m; long long atari = (n - (n / 1000 / m) * 1000 * m) / 1000; // cout << atari << endl; long long ans; if (n == 0) { ans = 0; } else{ ans = 1; int small = min(atari, m - atari); vector<bool> check(small + 1, false); //mCatari for (int i = 0; i < small; i++) { ans *= (m - i); for (int j = small; j > 1; j--) { if (!check[j] && ans % j == 0) { check[j] = true; ans /= j; } } } } ans %= mod; cout << ans << endl; return 0; }