結果
| 問題 |
No.129 お年玉(2)
|
| コンテスト | |
| ユーザー |
misora192
|
| 提出日時 | 2020-05-30 22:12:06 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 783 bytes |
| コンパイル時間 | 1,803 ms |
| コンパイル使用メモリ | 166,280 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-08 09:45:21 |
| 合計ジャッジ時間 | 3,867 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 4 WA * 42 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll n, m;
cin >> n >> m;
n /= 1000;
n %= m;
ll MOD = 1e9;
int max_m = 10101;
ll c[2][max_m];
rep(i, 2) rep(j, max_m) c[i][j] = 0;
c[1][0] = c[1][1] = 1;
for(int i = 2; i <= m; i++){
rep(j, max_m) c[i%2][j] = 0;
c[i%2][0] = c[i%2][i] = 1;
for(int j = i + 1; j <= i - 1; j++){
c[i%2][j] = c[(i-1)%2][j-1] + c[(i-1)%2][j];
c[i%2][j] %= MOD;
}
}
cout << c[m%2][n] << endl;
}
misora192