結果

問題 No.683 Two Operations No.3
ユーザー 💕💖💞💕💖💞
提出日時 2018-06-15 00:56:59
言語 Kotlin
(1.9.23)
結果
RE  
実行時間 -
コード長 442 bytes
コンパイル時間 11,039 ms
コンパイル使用メモリ 434,368 KB
実行使用メモリ 57,944 KB
最終ジャッジ日時 2024-04-30 18:52:22
合計ジャッジ時間 15,636 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 266 ms
56,812 KB
testcase_01 AC 272 ms
56,908 KB
testcase_02 AC 266 ms
56,864 KB
testcase_03 AC 265 ms
56,860 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 264 ms
56,920 KB
testcase_07 AC 265 ms
56,944 KB
testcase_08 RE -
testcase_09 AC 268 ms
56,812 KB
testcase_10 AC 262 ms
57,084 KB
testcase_11 AC 264 ms
56,928 KB
testcase_12 RE -
testcase_13 AC 261 ms
56,808 KB
testcase_14 AC 266 ms
56,944 KB
testcase_15 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:12:10: warning: parameter 'args' is never used
fun main(args:Array<String>) {
         ^

ソースコード

diff #

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