結果
問題 | No.805 UMG |
ユーザー |
|
提出日時 | 2021-06-24 19:15:01 |
言語 | Swift (6.0.3) |
結果 |
TLE
|
実行時間 | - |
コード長 | 463 bytes |
コンパイル時間 | 9,966 ms |
コンパイル使用メモリ | 127,852 KB |
実行使用メモリ | 18,176 KB |
最終ジャッジ日時 | 2024-11-18 14:11:53 |
合計ジャッジ時間 | 46,186 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 TLE * 11 |
ソースコード
let N = Int(readLine()!)! let S = String(readLine()!) let l = (N-3)/2 var c = 0 for i in 0...l{ //文字間隔 for j in 0...(N-1)-(i+1)*2{ //print(j,j+(i+1),j+(i+1)*2) var t = [S.index(S.startIndex, offsetBy: j)] t += [S.index(S.startIndex, offsetBy: j+(i+1))] t += [S.index(S.startIndex, offsetBy: j+(i+1)*2)] let T = t.map{String(S[$0])} if T.joined() == "UMG"{ c += 1 } } } print(c)