結果
| 問題 |
No.2561 みんな大好きmod 998
|
| コンテスト | |
| ユーザー |
momoyuu
|
| 提出日時 | 2023-12-15 12:15:35 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 4,000 ms |
| コード長 | 545 bytes |
| コンパイル時間 | 874 ms |
| コンパイル使用メモリ | 91,608 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-27 06:14:36 |
| 合計ジャッジ時間 | 2,641 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 44 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
ll n,k;
ll a[30];
ll ans;
void dfs(int ni,ll aa,ll b,int cnt){
if(ni==n) return;
dfs(ni+1,aa,b,cnt);
aa += a[ni];
b += a[ni];
aa %= 998244353;
b %= 998;
cnt++;
if(cnt==k){
if(b>=aa) ans++;
return;
}
dfs(ni+1,aa,b,cnt);
}
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
cin>>n>>k;
for(int i = 0;i<n;i++) cin>>a[i];
dfs(0,0,0,0);
cout<<ans%998<<endl;
}
momoyuu