用户输出
962287892
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#68899 | #1288. 上楼梯(改) | Accepted | 100 | 101 ms | 3796 K | C++ 11 / 681 B | 该起什么名字 | 2022-04-20 17:25:56 |
#include <bits/stdc++.h>
#define F(i, n, m) for (int i = n; i < m; i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
inline int read() {
int num = 0;
char c;
bool flag = false;
while ((c = getchar()) == ' ' || c == '\n' || c == '\r')
;
if (c == '-')
flag = true;
else
num = c - '0';
while (isdigit(c = getchar())) num = num * 10 + c - '0';
return (flag ? -1 : 1) * num;
}
#define mod 998244353
int a[1000005];
int main() {
std::ios::sync_with_stdio(false);
int n;
n = read();
a[0] = 1, a[2] = 1, a[3] = 1;
F(i, 4, n + 1) { a[i] = (a[i - 2] % mod + a[i - 3] % mod) % mod; }
cout << a[n];
return 0;
}