結果

問題 No.683 Two Operations No.3
ユーザー むらためむらため
提出日時 2019-01-26 12:46:24
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 585 bytes
コンパイル時間 2,310 ms
コンパイル使用メモリ 66,188 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-14 02:55:37
合計ジャッジ時間 2,509 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
  while true:
    let k = getchar_unlocked()
    if k < '0': break
    result = 10 * result + k.ord - '0'.ord

proc solve(a,b:int):bool =
  var a = min(a,b)
  var b = max(a,b)
  if a == 0 : return b <= 1
  if a mod 2 == 1 :
    if b mod 2 == 1 : return false
    return solve(a-1,b div 2)
  if b mod 2 == 1 : return solve(a div 2,b - 1)
  if solve(a div 2 , b - 1) : return true
  return solve(a - 1 , b div 2)

let a = scan()
let b = scan()
if solve(a,b) : echo "Yes"
else: echo "No"
0