結果
| 問題 |
No.683 Two Operations No.3
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-11 22:28:54 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 519 bytes |
| コンパイル時間 | 652 ms |
| コンパイル使用メモリ | 70,664 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-28 04:31:32 |
| 合計ジャッジ時間 | 1,318 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 8 WA * 8 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int msb(long long n) {
for (int i = 60; i >= 0; i--) {
if (n >> i & 1) return i;
}
return -1;
}
bool f(long long a, long long b) {
int c = 0;
long long y = 0;
for (int i = msb(a) - 1; i >= 0; i--) {
y++;
if (a >> i & 1) {
y *= 2;
}
}
return y == b;
}
int main() {
long long a, b;
cin >> a >> b;
if (f(a, b) || f(b, a)) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}