結果

問題 No.1372 Median of Submasks
ユーザー face4face4
提出日時 2021-07-24 11:11:07
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 292 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 14,689 ms
コンパイル使用メモリ 411,332 KB
実行使用メモリ 53,048 KB
最終ジャッジ日時 2023-09-26 21:29:45
合計ジャッジ時間 24,803 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 287 ms
52,588 KB
testcase_01 AC 281 ms
52,704 KB
testcase_02 AC 279 ms
52,500 KB
testcase_03 AC 282 ms
52,756 KB
testcase_04 AC 283 ms
52,712 KB
testcase_05 AC 280 ms
52,468 KB
testcase_06 AC 282 ms
52,940 KB
testcase_07 AC 283 ms
52,452 KB
testcase_08 AC 285 ms
53,048 KB
testcase_09 AC 288 ms
53,012 KB
testcase_10 AC 290 ms
52,720 KB
testcase_11 AC 291 ms
52,456 KB
testcase_12 AC 287 ms
52,936 KB
testcase_13 AC 285 ms
52,460 KB
testcase_14 AC 283 ms
52,724 KB
testcase_15 AC 283 ms
52,584 KB
testcase_16 AC 283 ms
52,588 KB
testcase_17 AC 284 ms
52,788 KB
testcase_18 AC 286 ms
52,984 KB
testcase_19 AC 287 ms
52,860 KB
testcase_20 AC 291 ms
52,460 KB
testcase_21 AC 289 ms
52,492 KB
testcase_22 AC 291 ms
52,500 KB
testcase_23 AC 292 ms
52,400 KB
testcase_24 AC 286 ms
52,512 KB
testcase_25 AC 284 ms
52,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fun main() {
    var n = readLine()!!.toLong().toString(2).toCharArray()
    var found = false
    for (i in n.indices) {
        if (n[i] == '0') continue
        if (!found) {
            found = true
        } else {
            n[i] = '0'
        }
    }
    println(n.concatToString().toLong(2))
}
0