結果
| 問題 |
No.342 一番ワロタww
|
| コンテスト | |
| ユーザー |
バカらっく
|
| 提出日時 | 2018-06-11 15:20:31 |
| 言語 | Swift (6.0.3) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 5,000 ms |
| コード長 | 1,140 bytes |
| コンパイル時間 | 886 ms |
| コンパイル使用メモリ | 125,096 KB |
| 実行使用メモリ | 9,472 KB |
| 最終ジャッジ日時 | 2024-11-30 12:28:41 |
| 合計ジャッジ時間 | 1,759 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 |
ソースコード
class Proc {
public func doProc() {
let text = readLine()!
let inpt = text.map{ $0 }
var pos = 0
var ans = [Int:[String]]()
for i in 0..<inpt.count {
if i < pos {
continue
}
if inpt[i] == "w" {
var nextStart = inpt.count
var cnt = 0
for j in i..<inpt.count {
if inpt[j] != "w" {
nextStart = j
break
} else {
cnt += 1
}
}
if i == 0 {
pos = nextStart
continue
}
let word = String(text.prefix(i).suffix(i-pos))
if ans[cnt] == nil {
ans[cnt] = [String]()
}
pos = nextStart
ans[cnt]!.append(word)
}
}
if let maxIdx = ans.keys.max() {
ans[maxIdx]!.forEach {
print($0)
}
}
}
}
Proc().doProc()
バカらっく