結果

問題 No.683 Two Operations No.3
ユーザー akakimidori
提出日時 2018-08-02 04:41:07
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 23,040 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-19 17:02:08
合計ジャッジ時間 937 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘run’:
main.c:20:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 |   scanf("%lld%lld",&a,&b);
      |   ^~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

int calc(int64 a,int64 b){
  if(a==0 || b==0) return 1;
  if(a%2==0 && calc(a/2,b-1)) return 1;
  if(b%2==0 && calc(a-1,b/2)) return 1;
  return 0;
}

void run(void){
  int64 a,b;
  scanf("%lld%lld",&a,&b);
  printf("%s\n",calc(a,b)?"Yes":"No");
}

int main(void){
  run();
  return 0;
}
0