結果

問題 No.1465 Archaea
ユーザー yuruhiyayuruhiya
提出日時 2021-04-03 10:25:46
言語 Crystal
(1.14.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 321 bytes
コンパイル時間 17,522 ms
コンパイル使用メモリ 295,216 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 13:21:41
合計ジャッジ時間 18,575 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

lib C
  fun strtoll(s : UInt8*, p : UInt8**, b : Int32) : Int64
end

class String
  def to_i64
    C.strtoll(self, nil, 10)
  end
end

n, k = read_line.split.map(&.to_i)
if n % 3 == 0
  puts "NO"
else
  cnt = 0
  while n > 1
    n = n.odd? || n == 4 ? n - 3 : n // 2
    cnt += 1
  end
  puts cnt <= k ? "YES" : "NO"
end
0