結果

問題 No.683 Two Operations No.3
ユーザー 826814741_6826814741_6
提出日時 2018-12-31 12:06:17
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 281 ms / 2,000 ms
コード長 436 bytes
コンパイル時間 11,454 ms
コンパイル使用メモリ 424,192 KB
実行使用メモリ 53,240 KB
最終ジャッジ日時 2023-08-13 01:09:26
合計ジャッジ時間 17,217 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 277 ms
53,032 KB
testcase_01 AC 278 ms
52,692 KB
testcase_02 AC 278 ms
53,240 KB
testcase_03 AC 273 ms
53,056 KB
testcase_04 AC 275 ms
52,676 KB
testcase_05 AC 277 ms
52,816 KB
testcase_06 AC 273 ms
52,968 KB
testcase_07 AC 274 ms
52,616 KB
testcase_08 AC 280 ms
52,948 KB
testcase_09 AC 278 ms
52,972 KB
testcase_10 AC 281 ms
52,736 KB
testcase_11 AC 279 ms
52,976 KB
testcase_12 AC 281 ms
52,756 KB
testcase_13 AC 279 ms
52,720 KB
testcase_14 AC 278 ms
52,740 KB
testcase_15 AC 279 ms
53,032 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:12:10: warning: parameter 'args' is never used
fun main(args: Array<String>){
         ^

ソースコード

diff #

fun f (a: Long, b: Long): Boolean =
    if (a==0L || b==0L)
        true
    else
        when {
            a%2L==1L&&b%2L==1L -> false
            a%2L==0L&&b%2L==1L -> f(a/2L,b.dec())
            a%2L==1L&&b%2L==0L -> f(a.dec(),b/2L)
            else -> f(a/2L,b.dec()) || f(a.dec(),b/2L)
        }

fun main(args: Array<String>){
    val (a,b) = readLine()!!.split(' ').map(String::toLong)
    println(if (f(a,b)) "Yes" else "No")
}
0