結果

問題 No.683 Two Operations No.3
ユーザー kerotono
提出日時 2018-05-12 00:47:59
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 480 bytes
コンパイル時間 772 ms
コンパイル使用メモリ 55,836 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-28 09:26:15
合計ジャッジ時間 1,082 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

bool DFS(long long int A, long long int B) {
    if (A == 0 || B == 0)
        return true;
    if (A % 2 == 1 && B % 2 == 1)
        return false;

    bool ans = false;

    if (A % 2 == 0)
        ans |= DFS(A / 2, B - 1);
    if (B % 2 == 0)
        ans |= DFS(A - 1, B / 2);

    return ans;
}

int main() {
    int A, B;
    cin >> A >> B;

    if (DFS(A, B))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
0