結果
| 問題 |
No.2791 Beginner Contest
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-21 22:37:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,045 bytes |
| コンパイル時間 | 1,692 ms |
| コンパイル使用メモリ | 167,952 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-21 22:37:26 |
| 合計ジャッジ時間 | 2,803 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 WA * 1 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
// OM NAMAH SHIVAY
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; // find_by_order, order_of_key
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
// int dx[4]={-1,0,1,0};
// int dy[4]={0,1,0,-1};
// int dx[8]={0,-1,-1,-1,0,1,1,1};
// int dy[8]={1,1,0,-1,-1,-1,0,1};
const int mod = 998244353;
using ii = pair<int,int>;
//write on copy
// 779869259
int add(int a, int b)
{
return ((a%mod)+(b%mod))%mod;
}
void solver(){
int n,k;
cin>>n>>k;
if(k>=n)
{
cout<<1<<endl;return;
}
vector<int>dp(n+1,0);
dp[0]=1;
int ans = 1;
for(int i=k;i<=n;i++)
{
dp[i]=add(dp[i-1],dp[i-k]);
ans = add(ans, dp[i]);
}
cout<<ans<<endl;
}
signed main()
{
IOS
//int _t;cin>>_t;while(_t--)
solver();
return 0;
}
#undef int