結果
問題 | No.805 UMG |
ユーザー | Maboy |
提出日時 | 2021-06-24 19:15:01 |
言語 | Swift (5.10.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 463 bytes |
コンパイル時間 | 8,999 ms |
コンパイル使用メモリ | 127,952 KB |
実行使用メモリ | 7,884 KB |
最終ジャッジ日時 | 2023-08-11 19:59:56 |
合計ジャッジ時間 | 14,363 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
7,840 KB |
testcase_01 | AC | 44 ms
7,824 KB |
testcase_02 | AC | 5 ms
7,728 KB |
testcase_03 | AC | 7 ms
7,752 KB |
testcase_04 | AC | 3 ms
7,752 KB |
testcase_05 | AC | 3 ms
7,848 KB |
testcase_06 | AC | 3 ms
7,816 KB |
testcase_07 | AC | 5 ms
7,800 KB |
testcase_08 | AC | 9 ms
7,764 KB |
testcase_09 | AC | 7 ms
7,732 KB |
testcase_10 | AC | 3 ms
7,880 KB |
testcase_11 | AC | 5 ms
7,800 KB |
testcase_12 | AC | 3 ms
7,884 KB |
testcase_13 | AC | 10 ms
7,844 KB |
testcase_14 | AC | 3 ms
7,700 KB |
testcase_15 | TLE | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
ソースコード
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)