Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
57540 | xuzifang | J3 | C++ | 运行超时 | 55 | 1000 MS | 628 KB | 910 | 2022-10-04 18:20:20 |
#include<bits/stdc++.h> using namespace std; const int mod = 998244353; const int maxn = 100000 + 10; int f[maxn]; int n, x, y; int dfs(int u){ if(f[u] != 0){ //cout << "return f[u]: " << f[u] << "; return u: " << u << endl; return f[u]; } for(int i = u; i >= 0; i--){ if(u - i > i){//i=>going to be put in, (u - i) => from where break; } if(i == y){ continue; } //cout << "in cycle, while u is " << u << ", i is " << i << ", "; f[u] = (f[u] + dfs(u - i)) % mod; //cout << "f[u] is " << f[u] << " and f[u - i] is " << f[u - i] << endl; } //cout << "after cycle, return f[u]: " << f[u] << "; return u: " << u << endl; return f[u]; } int main(){ //freopen("J3.in", "r", stdin); //freopen("J3.out", "w", stdout); scanf("%d %d %d", &n, &x, &y); for(int i = 1; i <= x; i++){ f[i] = 0; } f[0] = 1; printf("%d\n", dfs(x)); return 0; }