結果

問題 No.683 Two Operations No.3
ユーザー 💕💖💞💕💖💞
提出日時 2018-06-15 00:52:40
言語 Kotlin
(1.9.23)
結果
RE  
実行時間 -
コード長 424 bytes
コンパイル時間 12,185 ms
コンパイル使用メモリ 432,996 KB
実行使用メモリ 58,964 KB
最終ジャッジ日時 2024-04-30 18:51:05
合計ジャッジ時間 18,837 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 316 ms
56,836 KB
testcase_02 AC 322 ms
56,828 KB
testcase_03 AC 326 ms
56,832 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:12:10: warning: parameter 'args' is never used
fun main(args:Array<String>) {
         ^

ソースコード

diff #

fun grad(a:Int, b:Int):Int {
  return when  { 
    a == 0 && b == 0 -> 1
    a == 0 -> 1
    a%2 == 1 && b%2 == 1 -> 0
    a%2 == 0 && b%2 == 0 -> grad(a-1, b/2) or grad(a/2, b-1)
    a%2 == 1 -> grad(a-1, b/2)
    b%2 == 1 -> grad(a/2, b-1)
    else -> 0
  }
}
fun main(args:Array<String>) {
  val (a, b) = readLine()!!.split(" ").map(String::toInt)
  when(grad(a, b)) {
    1 -> "Yes"
    else -> "No"
  }.run(::println)
}
0