結果
| 問題 | No.3431 popcount & sum (Easy) |
| コンテスト | |
| ユーザー |
SnowBeenDiding
|
| 提出日時 | 2026-01-11 15:53:55 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 724 bytes |
| 記録 | |
| コンパイル時間 | 9,155 ms |
| コンパイル使用メモリ | 420,840 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-01-11 15:54:06 |
| 合計ジャッジ時間 | 10,030 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 |
ソースコード
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace atcoder;
using namespace std;
typedef long long ll;
using mint = modint998244353;
int f(int a, int b) {
int pa = __builtin_popcount(a);
int pb = __builtin_popcount(b);
if (pa == pb)
return a & b;
else
return 0;
}
void solve() {
int n;
cin >> n;
mint ans = 0;
rep(a, 0, n + 1) rep(b, a, n + 1) { ans += f(a, b); }
cout << ans.val() << endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
while (t--) solve();
}
SnowBeenDiding