結果
| 問題 | No.3431 popcount & sum (Easy) |
| コンテスト | |
| ユーザー |
forest3
|
| 提出日時 | 2026-05-01 15:53:35 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 2,000 ms |
| コード長 | 386 bytes |
| 記録 | |
| コンパイル時間 | 1,153 ms |
| コンパイル使用メモリ | 180,156 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-01 15:53:39 |
| 合計ジャッジ時間 | 2,801 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i < b; i++)
using ll = long long;
int main(){
int n;
cin >> n;
auto f = [](int a, int b) {
if(__builtin_popcount(a) == __builtin_popcount(b)) return a & b;
return 0;
};
ll ans = 0;
rep(i, 0, n + 1) {
rep(j, i, n + 1) {
ans += f(i, j);
ans %= 998244353;
}
}
cout << ans << endl;
}
forest3