用户输出
962287892
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#82067 | #1288. 上楼梯(改) | Accepted | 100 | 67 ms | 3700 K | C++ 11 / 556 B | y | 2023-03-10 20:55:06 |
#include <cstdio>
#define N 1000009
#define p 998244353
#define RI register int
using namespace std;
int n, f[N];
inline int read();
inline void M(int& x) { x = x < p ? x : x - p; }
int main() {
n = read();
f[0] = 1;
for (RI i = 0; i < n; ++i) M(f[i + 2] += f[i]), M(f[i + 3] += f[i]);
printf("%d\n", f[n]);
return 0;
}
inline int read() {
int x = 0;
char c = getchar();
while (c > '9' || c < '0') c = getchar();
while (c >= '0' && c <= '9') {
x *= 10;
x += c - '0';
c = getchar();
}
return x;
}