結果
問題 | No.805 UMG |
ユーザー |
![]() |
提出日時 | 2019-03-22 21:33:58 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 567 ms / 2,000 ms |
コード長 | 364 bytes |
コンパイル時間 | 764 ms |
コンパイル使用メモリ | 82,172 KB |
実行使用メモリ | 75,388 KB |
最終ジャッジ日時 | 2024-11-18 13:15:20 |
合計ジャッジ時間 | 5,027 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#!/usr/bin/env pypy3 import itertools def solve(n, s): res = 0 for i, j in itertools.combinations(range(n), 2): k = 2 * j - i if j < k < n and s[i] == "U" and s[j] == "M" and s[k] == "G": res += 1 return res def main(): n = int(input()) s = input() print(solve(n, s)) if __name__ == "__main__": main()