結果
問題 | No.1450 nahco314's First Problem |
ユーザー |
![]() |
提出日時 | 2024-08-10 13:21:13 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 578 bytes |
コンパイル時間 | 2,549 ms |
コンパイル使用メモリ | 243,592 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-08-10 13:21:18 |
合計ジャッジ時間 | 4,321 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,m,n) for(int i=m; i<n; ++i) #define repl(i,m,n) for(ll i=m; i<n; ++i) #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() int main(){ ll X; cin >> X; for(ll m = 1LL; m < 64LL; ++m){ ll n = X ^ m; ll cnt = 0; rep(i, 0, 64){ if(n & (1LL << i)){ cnt++; } } if(cnt == m){ cout << n << endl; return 0; } } cout << -1 << endl; return 0; }