結果

問題 No.524 コインゲーム
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2017-06-02 22:47:25
言語 Kotlin
(1.9.10)
結果
AC  
実行時間 271 ms / 1,000 ms
コード長 3,153 bytes
コンパイル時間 13,883 ms
コンパイル使用メモリ 418,676 KB
実行使用メモリ 50,440 KB
最終ジャッジ日時 2023-08-12 19:00:33
合計ジャッジ時間 25,496 ms
ジャッジサーバーID
(参考情報)
judge8 / judge9
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 271 ms
50,096 KB
testcase_01 AC 266 ms
50,080 KB
testcase_02 AC 264 ms
50,048 KB
testcase_03 AC 262 ms
49,968 KB
testcase_04 AC 261 ms
50,312 KB
testcase_05 AC 267 ms
50,220 KB
testcase_06 AC 266 ms
50,096 KB
testcase_07 AC 264 ms
50,056 KB
testcase_08 AC 262 ms
50,100 KB
testcase_09 AC 259 ms
50,064 KB
testcase_10 AC 262 ms
50,064 KB
testcase_11 AC 260 ms
50,088 KB
testcase_12 AC 261 ms
50,116 KB
testcase_13 AC 261 ms
50,112 KB
testcase_14 AC 260 ms
49,824 KB
testcase_15 AC 270 ms
50,440 KB
testcase_16 AC 269 ms
50,004 KB
testcase_17 AC 263 ms
49,840 KB
testcase_18 AC 261 ms
50,032 KB
testcase_19 AC 261 ms
50,092 KB
testcase_20 AC 263 ms
49,992 KB
testcase_21 AC 262 ms
50,124 KB
testcase_22 AC 268 ms
49,988 KB
testcase_23 AC 271 ms
50,100 KB
testcase_24 AC 267 ms
50,020 KB
testcase_25 AC 260 ms
50,004 KB
testcase_26 AC 265 ms
50,312 KB
testcase_27 AC 269 ms
50,004 KB
testcase_28 AC 262 ms
50,160 KB
testcase_29 AC 266 ms
49,868 KB
testcase_30 AC 270 ms
50,092 KB
testcase_31 AC 264 ms
49,896 KB
testcase_32 AC 264 ms
49,924 KB
testcase_33 AC 265 ms
50,088 KB
testcase_34 AC 263 ms
49,832 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:12:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^
Main.kt:83:22: warning: 'toInt(): Int' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead.
        if (b == '-'.toInt()) {
                     ^
Main.kt:87:21: warning: 'toInt(): Int' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead.
        if (b < '0'.toInt() || '9'.toInt() < b) {
                    ^
Main.kt:87:36: warning: 'toInt(): Int' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead.
        if (b < '0'.toInt() || '9'.toInt() < b) {
                                   ^
Main.kt:91:21: warning: 'toInt(): Int' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead.
            if ('0'.toInt() <= b && b <= '9'.toInt()) {
                    ^
Main.kt:91:46: warning: 'toInt(): Int' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead.
            if ('0'.toInt() <= b && b <= '9'.toInt()) {
                                             ^
Main.kt:93:31: warning: 'toInt(): Int' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead.
                n += (b - '0'.toInt()).toLong()
                              ^

ソースコード

diff #

import java.util.*
import java.util.NoSuchElementException
import java.io.IOException
import java.util.PriorityQueue
import java.util.Arrays
import java.util.ArrayList



var sc : FastScanner = FastScanner()

fun main(args: Array<String>) {
    var N = sc.nextLong()

    if(N % 4L == 3L) println("X")
    else println("O")
}





class FastScanner {
    private val `in` = System.`in`
    private val buffer = ByteArray(1024)
    private var ptr = 0
    private var bufferLength = 0

    private fun hasNextByte(): Boolean {
        if (ptr < bufferLength) {
            return true
        } else {
            ptr = 0
            try {
                bufferLength = `in`.read(buffer)
            } catch (e: IOException) {
                e.printStackTrace()
            }

            if (bufferLength <= 0) {
                return false
            }
        }
        return true
    }

    private fun readByte(): Int {
        if (hasNextByte())
            return buffer[ptr++].toInt()
        else
            return -1
    }

    private fun isPrintableChar(c: Int): Boolean {
        return 33 <= c && c <= 126
    }

    private fun skipUnprintable() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr].toInt())) ptr++
    }

    internal operator fun hasNext(): Boolean {
        skipUnprintable()
        return hasNextByte()
    }

    operator fun next(): String {
        if (!hasNext()) throw NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b)
            b = readByte()
        }
        return sb.toString()
    }

    internal fun nextLong(): Long {
        if (!hasNext()) throw NoSuchElementException()
        var n: Long = 0
        var minus = false
        var b = readByte()
        if (b == '-'.toInt()) {
            minus = true
            b = readByte()
        }
        if (b < '0'.toInt() || '9'.toInt() < b) {
            throw NumberFormatException()
        }
        while (true) {
            if ('0'.toInt() <= b && b <= '9'.toInt()) {
                n *= 10
                n += (b - '0'.toInt()).toLong()
            } else if (b == -1 || !isPrintableChar(b)) {
                return if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }

    internal fun nextDouble(): Double {
        return java.lang.Double.parseDouble(next())
    }

    internal fun nextDoubleArray(n: Int): DoubleArray {
        val array = DoubleArray(n)
        for (i in 0..n - 1) {
            array[i] = nextDouble()
        }
        return array
    }

    internal fun nextDoubleMap(n: Int, m: Int): Array<DoubleArray?> {
        val map = arrayOfNulls<DoubleArray?>(n)
        for (i in 0..n - 1) {
            map[i] = nextDoubleArray(m)
        }
        return map
    }

    fun nextInt(): Int {
        return nextLong().toInt()
    }

    fun nextIntArray(n: Int): IntArray {
        val array = IntArray(n)
        for (i in 0..n - 1) {
            array[i] = nextInt()
        }
        return array
    }
}
0