結果

問題 No.9010 うるう年判定
ユーザー matsumomatsumo
提出日時 2020-11-14 22:38:54
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 277 ms / 2,000 ms
コード長 1,147 bytes
コンパイル時間 13,828 ms
コンパイル使用メモリ 423,100 KB
実行使用メモリ 52,156 KB
最終ジャッジ日時 2023-09-30 06:37:24
合計ジャッジ時間 23,228 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 264 ms
50,224 KB
testcase_01 AC 260 ms
50,296 KB
testcase_02 AC 263 ms
50,360 KB
testcase_03 AC 261 ms
50,484 KB
testcase_04 AC 262 ms
50,220 KB
testcase_05 AC 263 ms
50,244 KB
testcase_06 AC 264 ms
50,328 KB
testcase_07 AC 265 ms
50,232 KB
testcase_08 AC 266 ms
50,240 KB
testcase_09 AC 264 ms
52,156 KB
testcase_10 AC 260 ms
50,256 KB
testcase_11 AC 263 ms
50,556 KB
testcase_12 AC 264 ms
50,340 KB
testcase_13 AC 262 ms
50,520 KB
testcase_14 AC 259 ms
50,332 KB
testcase_15 AC 264 ms
50,512 KB
testcase_16 AC 264 ms
50,304 KB
testcase_17 AC 277 ms
50,308 KB
testcase_18 AC 260 ms
50,576 KB
testcase_19 AC 262 ms
50,780 KB
testcase_20 AC 261 ms
50,488 KB
testcase_21 AC 262 ms
50,264 KB
testcase_22 AC 268 ms
50,344 KB
testcase_23 AC 261 ms
50,452 KB
testcase_24 AC 257 ms
50,196 KB
testcase_25 AC 261 ms
50,372 KB
testcase_26 AC 262 ms
50,248 KB
testcase_27 AC 260 ms
50,392 KB
testcase_28 AC 267 ms
50,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use {
        out.use {
//        repeat(readInteger()) { solve() }
            solve()
            out.flush()
        }
    }
}

fun solve() {
    val n = readInteger()

//    ・西暦年が4で割り切れる年はうるう年
//    ・ただし、西暦年が100で割り切れる年は平年
//    ・ただし、西暦年が400で割り切れる年はうるう年
    val ans = if (n % 400 == 0) {
        "Yes"
    } else {
        if (n % 100 == 0) {
            "No"
        } else {
            if (n % 4 == 0) "Yes" else "No"
        }
    }
    out.println(ans)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)
0