結果
問題 |
No.129 お年玉(2)
|
ユーザー |
|
提出日時 | 2015-01-16 23:56:01 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 667 bytes |
コンパイル時間 | 521 ms |
コンパイル使用メモリ | 61,804 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-22 12:54:14 |
合計ジャッジ時間 | 3,246 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; long long small = min(atari, m - atari); vector<bool> check(small + 1, false); //mCatari for (long long i = 0; i < small; i++) { ans *= (m - i); for (long long j = small; j > 1; j--) { if (!check[j] && ans % j == 0) { check[j] = true; ans /= j; } } } } ans %= mod; cout << ans << endl; return 0; }