結果
問題 | No.82 市松模様 |
ユーザー | yo-kondo |
提出日時 | 2018-03-25 16:38:30 |
言語 | Kotlin (1.9.23) |
結果 |
AC
|
実行時間 | 282 ms / 5,000 ms |
コード長 | 859 bytes |
コンパイル時間 | 9,695 ms |
コンパイル使用メモリ | 431,268 KB |
実行使用メモリ | 67,136 KB |
最終ジャッジ日時 | 2024-04-30 17:32:06 |
合計ジャッジ時間 | 13,399 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 258 ms
56,680 KB |
testcase_01 | AC | 266 ms
56,844 KB |
testcase_02 | AC | 263 ms
56,740 KB |
testcase_03 | AC | 256 ms
56,768 KB |
testcase_04 | AC | 259 ms
56,852 KB |
testcase_05 | AC | 269 ms
56,840 KB |
testcase_06 | AC | 265 ms
56,848 KB |
testcase_07 | AC | 258 ms
56,760 KB |
testcase_08 | AC | 278 ms
65,092 KB |
testcase_09 | AC | 282 ms
67,136 KB |
コンパイルメッセージ
Main.kt:6:10: warning: parameter 'args' is never used fun main(args: Array<String>) { ^
ソースコード
package yukicoder.no82 /** * エントリポイント */ fun main(args: Array<String>) { val in1 = readLine() print(checkeredPattern(in1)) } /** * 幅、高さ、色をもとに市松模様を返します。最後に改行が入ります。 * @param widthHeightColor 幅、高さ、色 */ fun checkeredPattern(widthHeightColor: String?): String { if (widthHeightColor == null) { return "" } var pattern = "" val sp = widthHeightColor.split(" ") // true="B",false="W" var color = sp[2] == "B" for (h in 1..sp[1].toInt()) { for (w in 1..sp[0].toInt()) { pattern += if (color) "B" else "W" color = !color } // 偶数の場合は反転 if (sp[0].toInt() % 2 == 0) { color = !color } pattern += "\n" } return pattern }