結果
問題 | No.1139 Slime Race |
ユーザー |
![]() |
提出日時 | 2020-07-31 22:10:13 |
言語 | Swift (6.0.3) |
結果 |
AC
|
実行時間 | 165 ms / 2,000 ms |
コード長 | 907 bytes |
コンパイル時間 | 10,098 ms |
コンパイル使用メモリ | 128,288 KB |
実行使用メモリ | 19,484 KB |
最終ジャッジ日時 | 2024-07-02 08:22:50 |
合計ジャッジ時間 | 12,719 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
コンパイルメッセージ
Main.swift:32:9: warning: initialization of immutable value 'X' was never used; consider replacing with assignment to '_' or removing it let X = (0 ..< N).map { _ in scanner.nextInt() } ~~~~^ _
ソースコード
fileprivate struct Scanner { private var elements = [String]() private var index = 0 mutating func peek() -> String { while elements.count == index { elements = readLine()!.split(separator: " ").map(String.init) index = 0 } return elements[index] } mutating func next() -> String { let value = peek() index += 1 return value } mutating func nextInt() -> Int { return Int(next())! } mutating func nextDouble() -> Double { return Double(next())! } } func main() { var scanner = Scanner() let N = scanner.nextInt() let D = scanner.nextInt() let X = (0 ..< N).map { _ in scanner.nextInt() } let V = (0 ..< N).map { _ in scanner.nextInt() } let sumV = V.reduce(0, +) let answer = (D + sumV - 1) / sumV print(answer) } main()