結果
問題 |
No.1372 Median of Submasks
|
ユーザー |
|
提出日時 | 2021-02-05 21:28:37 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 373 bytes |
コンパイル時間 | 2,200 ms |
コンパイル使用メモリ | 191,452 KB |
最終ジャッジ日時 | 2025-01-18 11:57:59 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 8 WA * 16 |
ソースコード
#include<bits/stdc++.h> //#include<atcoder/all> //using namespace atcoder; using namespace std; using ll = long long; ll cnt(int x){ ll res = 0; while(x){ res += x&1; x/=2; } return res; } int main(){ ll n; cin >> n; if(cnt(n)==1){ cout<<n<<endl; } else{ for(int i = 0;;i++){ if(n>>i&1){ n -= 1<<i; cout<<n<<endl; return 0; } } } }