結果
| 問題 |
No.1450 nahco314's First Problem
|
| コンテスト | |
| ユーザー |
🍮かんプリン
|
| 提出日時 | 2021-03-31 23:37:54 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 493 bytes |
| コンパイル時間 | 1,628 ms |
| コンパイル使用メモリ | 165,776 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-08 14:23:29 |
| 合計ジャッジ時間 | 3,219 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
/**
* @FileName a.cpp
* @Author kanpurin
* @Created 2021.03.31 23:37:47
**/
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int hamingu(ll n) {
int ans = 0;
while(n) {
if (n & 1) ans++;
n >>= 1;
}
return ans;
}
int main() {
ll x;cin >> x;
for (int i = 1; i <= 64; i++) {
if (hamingu(x ^ i) == i) {
cout << (x ^ i) << endl;
return 0;
}
}
cout << -1 << endl;
return 0;
}
🍮かんプリン