結果
| 問題 | 
                            No.1298 OR XOR
                             | 
                    
| コンテスト | |
| ユーザー | 
                             rutilicus
                         | 
                    
| 提出日時 | 2020-12-13 15:09:18 | 
| 言語 | Kotlin  (2.1.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 567 bytes | 
| コンパイル時間 | 11,882 ms | 
| コンパイル使用メモリ | 426,216 KB | 
| 実行使用メモリ | 57,020 KB | 
| 最終ジャッジ日時 | 2024-09-19 23:28:56 | 
| 合計ジャッジ時間 | 17,860 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 5 WA * 8 | 
コンパイルメッセージ
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()!!
}
            
            
            
        
            
rutilicus