結果
問題 | No.2561 みんな大好きmod 998 |
ユーザー |
![]() |
提出日時 | 2023-12-02 15:57:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,570 ms / 4,000 ms |
コード長 | 676 bytes |
コンパイル時間 | 700 ms |
コンパイル使用メモリ | 72,832 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-26 19:36:13 |
合計ジャッジ時間 | 21,439 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 44 |
ソースコード
#include<iostream> #include<vector> #include<algorithm> #include<bitset> using namespace std; int main() { int n, k; cin >> n >> k; vector<long long> a(n); for (int i = 0; i < n; i++) cin >> a[i]; int m1 = 998, m2 = 998244353; long long res = 0; for (long long i = 0; i < (1LL << n); i++) { bitset<28> I(i); //cout << I << endl; if (I.count() != k) continue; //cout << I << endl; long long sum = 0; for (int j = 0; j < n; j++) { if (I.test(j)) sum += a[j]; } //cout << sum << endl; if (sum % m2 <= sum % m1) res++; } res %= 998; cout << res << endl; }