結果
| 問題 | No.3431 popcount & sum (Easy) |
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2026-01-17 00:22:02 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 2,000 ms |
| コード長 | 419 bytes |
| 記録 | |
| コンパイル時間 | 3,285 ms |
| コンパイル使用メモリ | 333,368 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-01-17 00:22:06 |
| 合計ジャッジ時間 | 4,166 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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