結果
| 問題 | No.3431 popcount & sum (Easy) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-22 01:40:32 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 2,000 ms |
| コード長 | 398 bytes |
| 記録 | |
| コンパイル時間 | 3,914 ms |
| コンパイル使用メモリ | 333,480 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-01-22 01:40:44 |
| 合計ジャッジ時間 | 4,218 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = (a); i <= (b); i ++)
using std::cin, std::cout, std::cerr;
using ll = long long;
int main() {
std::ios::sync_with_stdio(false);
int n; cin >> n;
auto p = [](int n) {
return __builtin_popcount(n);
};
int ans = 0;
rep(i, 0, n) rep(j, i, n) if(p(i) == p(j))
ans += (i & j);
cout << ans << '\n';
}