結果
問題 |
No.1372 Median of Submasks
|
ユーザー |
![]() |
提出日時 | 2021-02-20 20:42:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 312 bytes |
コンパイル時間 | 1,768 ms |
コンパイル使用メモリ | 190,764 KB |
最終ジャッジ日時 | 2025-01-19 02:47:20 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 = 0; REP(i, 0, 60) cnt += ((n>>i)&1); ll a = (1 << cnt) / 2, ans = 0; REP(i, 0, 60) if((n>>i)&1) { if(a&1) ans |= (1<<i); a >>= 1; } printf("%ld\n", ans); return 0; }