結果
問題 | No.1298 OR XOR |
ユーザー | rutilicus |
提出日時 | 2020-12-13 15:11:58 |
言語 | Kotlin (1.9.23) |
結果 |
AC
|
実行時間 | 304 ms / 2,000 ms |
コード長 | 571 bytes |
コンパイル時間 | 11,975 ms |
コンパイル使用メモリ | 434,152 KB |
実行使用メモリ | 54,156 KB |
最終ジャッジ日時 | 2023-10-20 03:42:41 |
合計ジャッジ時間 | 17,677 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 286 ms
54,136 KB |
testcase_01 | AC | 290 ms
54,152 KB |
testcase_02 | AC | 294 ms
54,136 KB |
testcase_03 | AC | 290 ms
54,144 KB |
testcase_04 | AC | 295 ms
54,132 KB |
testcase_05 | AC | 292 ms
54,144 KB |
testcase_06 | AC | 293 ms
54,156 KB |
testcase_07 | AC | 296 ms
54,152 KB |
testcase_08 | AC | 294 ms
54,148 KB |
testcase_09 | AC | 304 ms
54,156 KB |
testcase_10 | AC | 296 ms
54,136 KB |
testcase_11 | AC | 295 ms
54,156 KB |
testcase_12 | AC | 295 ms
54,156 KB |
testcase_13 | AC | 297 ms
54,148 KB |
コンパイルメッセージ
Main.kt:23:17: warning: 'appendln(String?): kotlin.text.StringBuilder /* = java.lang.StringBuilder */' is deprecated. Use appendLine instead. Note that the new method always appends the line feed character '\n' regardless of the system line separator. builder.appendln("$a $b $n") ^ Main.kt:25:17: warning: 'appendln(String?): kotlin.text.StringBuilder /* = java.lang.StringBuilder */' is deprecated. Use appendLine instead. Note that the new method always appends the line feed character '\n' regardless of the system line separator. builder.appendln("-1 -1 -1") ^
ソースコード
fun main() { val builder = StringBuilder() val n = readInputLine().toInt() var a = 0 var b = 0 var addA = true for (i in 0 until 30) { if ((n shr i) and 1 == 1) { if (addA) { a = a or (1 shl i) } else { b = b or (1 shl i) } addA = !addA } } if (b != 0) { builder.appendln("$a $b $n") } else { builder.appendln("-1 -1 -1") } print(builder.toString()) } fun readInputLine(): String { return readLine()!! }