結果
| 問題 |
No.683 Two Operations No.3
|
| コンテスト | |
| ユーザー |
とばり
|
| 提出日時 | 2018-09-06 12:41:01 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 618 bytes |
| コンパイル時間 | 1,347 ms |
| コンパイル使用メモリ | 167,008 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-21 17:38:39 |
| 合計ジャッジ時間 | 2,024 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
using uint64 = unsigned long long;
int64 f(int64 A, int64 B)
{
if (A < B) swap(A, B);
if (B == 0)
{
return true;
}
bool res = false;
if (A % 2 == 0 and B - 1 >= 0)
{
res = res || f(A / 2, B - 1);
}
if (B % 2 == 0 and A - 1 >= 0)
{
res = res || f(A - 1, B / 2);
}
return res;
}
int main()
{
cin.tie(nullptr);
ios::sync_with_stdio(false);
int64 A, B;
cin >> A >> B;
if (f(A, B)) cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
}
とばり