結果

問題 No.683 Two Operations No.3
ユーザー xxxasdfghjkxxxasdfghjk
提出日時 2018-08-13 14:41:26
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 846 bytes
コンパイル時間 1,107 ms
コンパイル使用メモリ 71,372 KB
実行使用メモリ 8,696 KB
最終ジャッジ日時 2023-10-24 16:40:37
合計ジャッジ時間 4,673 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
7,700 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
bool solve(ll A,ll B){
  
  if(A == 0 && B == 0)
    return true;
  else if(A % 2 == 1 && B % 2 == 1)
    return false;
  else{
    if(A % 2 == 0 && B % 2 == 0){
      return solve(A/2,B-1);// || solve(A-1,B/2);
    }else{
      if(A % 2 == 1)
        return solve(A-1,B/2);
      else
        return solve(A/2,B-1);
    }
  }
  
}

int main()
{
  ll A,B;
  cin >> A >> B;
  if(B > A)
    swap(A,B);
  if(solve(A,B)){
    cout << "Yes" << endl;
  }else
    cout << "No" << endl;
  return 0;
}

0