結果
| 問題 |
No.1450 nahco314's First Problem
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2021-03-31 14:38:49 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 377 bytes |
| コンパイル時間 | 4,420 ms |
| コンパイル使用メモリ | 190,436 KB |
| 最終ジャッジ日時 | 2025-01-20 01:32:49 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
ull X;
ull popcount(ull x){
ull res=0;
rep(d,63) res += ((x>>d)&1ull);
return res;
}
int main(){
cin>>X;
for(int d=1; d<=63; d++){
if(popcount(X^d)==d){ cout<<(X^d)<<"\n"; return 0; }
}
cout<<-1<<endl;
return 0;
}
Nachia