結果
| 問題 |
No.1372 Median of Submasks
|
| ユーザー |
y61mpnl
|
| 提出日時 | 2021-02-20 20:46:03 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 302 bytes |
| コンパイル時間 | 1,726 ms |
| コンパイル使用メモリ | 191,024 KB |
| 最終ジャッジ日時 | 2025-01-19 02:47:29 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 WA * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%ld", &n);
| ~~~~~^~~~~~~~~~~
ソースコード
#include<bits/stdc++.h>
#define REP(i,b,e) for(int i=b;i<e;i++)
using ll = int_fast64_t;
int main(){
ll n;
scanf("%ld", &n);
ll cnt = __builtin_popcount(n);
ll a = (1l << cnt) / 2, ans = 0;
REP(i, 0, 60) if((n>>i)&1l) {
if(a&1l) ans |= (1l<<i);
a >>= 1;
}
printf("%ld\n", ans);
return 0;
}
y61mpnl