結果
| 問題 | No.3431 popcount & sum (Easy) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-11 14:41:33 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 2,000 ms |
| コード長 | 437 bytes |
| 記録 | |
| コンパイル時間 | 3,284 ms |
| コンパイル使用メモリ | 334,880 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-01-11 14:41:37 |
| 合計ジャッジ時間 | 3,641 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using mint = atcoder::modint998244353;
int main(){
int n;
cin >> n;
mint ans=0;
rep(i,n+1)
rep(j,n+1){
if(j<i)continue;
if(__builtin_popcount(i) != __builtin_popcount(j))continue;
ans+=(i&j);
}
cout << ans.val() << endl;
return 0;
}