結果
| 問題 | No.3431 popcount & sum (Easy) |
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2026-01-17 00:22:02 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| + 752µs | |
| コード長 | 419 bytes |
| 記録 | |
| コンパイル時間 | 2,099 ms |
| コンパイル使用メモリ | 329,420 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-20 11:26:07 |
| 合計ジャッジ時間 | 3,269 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n;
cin >> n;
int ans = 0;
for (unsigned a = 0; a <= n; ++a) {
for (unsigned b = a; b <= n; ++b) {
if (popcount(a) == popcount(b)) ans += a & b;
}
}
cout << ans << '\n';
return 0;
}
a01sa01to