結果
| 問題 | No.1298 OR XOR | 
| コンテスト | |
| ユーザー |  rutilicus | 
| 提出日時 | 2020-12-13 15:11:58 | 
| 言語 | Kotlin (2.1.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 275 ms / 2,000 ms | 
| コード長 | 571 bytes | 
| コンパイル時間 | 10,706 ms | 
| コンパイル使用メモリ | 435,524 KB | 
| 実行使用メモリ | 56,908 KB | 
| 最終ジャッジ日時 | 2024-09-19 23:29:12 | 
| 合計ジャッジ時間 | 15,167 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 13 | 
コンパイルメッセージ
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()!!
}
            
            
            
        