結果
問題 |
No.2561 みんな大好きmod 998
|
ユーザー |
![]() |
提出日時 | 2023-12-02 18:19:17 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 265 ms / 4,000 ms |
コード長 | 496 bytes |
コンパイル時間 | 2,013 ms |
コンパイル使用メモリ | 194,004 KB |
最終ジャッジ日時 | 2025-02-18 06:06:15 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 44 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; ll N,K,A[28]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin>>N>>K; for(int i=0;i<N;i++)cin>>A[i]; vector<int>a(N,0); for(int i=0;i<K;i++)a[i]=1; reverse(a.begin(),a.end()); ll ans=0; do { ll sum=0; for(int i=0;i<N;i++)if(a[i])sum+=A[i]; if(sum%998244353<=sum%998)ans++; }while(next_permutation(a.begin(),a.end())); cout << ans%998 << endl; }