結果
問題 |
No.46 はじめのn歩
|
ユーザー |
|
提出日時 | 2019-01-03 18:35:43 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 308 ms / 5,000 ms |
コード長 | 1,202 bytes |
コンパイル時間 | 11,529 ms |
コンパイル使用メモリ | 437,304 KB |
実行使用メモリ | 51,196 KB |
最終ジャッジ日時 | 2024-11-20 17:22:02 |
合計ジャッジ時間 | 15,449 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
コンパイルメッセージ
Main.kt:19:10: warning: parameter 'args' is never used fun main(args: Array<String>) { ^
ソースコード
// No.46 はじめのn歩 // https://yukicoder.me/problems/no/46 package no01.yukicoder.no46 import kotlin.math.ceil /** インプットデータ */ data class InputData( /** 1歩で歩ける距離 */ val walk: Double, /** 区間の距離 */ val section: Double ) /** * エントリポイント */ fun main(args: Array<String>) { val input = getStandardInput() println(stepCount(input)) } /** * 最小で何歩歩くかを返します。 */ fun stepCount(input: List<String>): Int { val data = createInputData(input) // 小数点を含めた割り算をしたあとに、切り上げ return ceil(data.section / data.walk).toInt() } /** * 標準入力から取得した文字列をInputDataに変換して返します。 */ fun createInputData(input: List<String>): InputData { val sp = input[0].split(" ") return InputData( sp[0].toDouble(), sp[1].toDouble() ) } /** * 標準入力から文字列を全て取得します。 */ fun getStandardInput(): List<String> { val lines = mutableListOf<String>() var s = readLine() while (s != null) { lines.add(s) s = readLine() } return lines }