結果
問題 | No.805 UMG |
ユーザー |
![]() |
提出日時 | 2020-07-09 12:35:09 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 22 ms / 2,000 ms |
コード長 | 545 bytes |
コンパイル時間 | 667 ms |
コンパイル使用メモリ | 94,260 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-18 14:04:51 |
合計ジャッジ時間 | 1,552 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <cassert>#include <cmath>#include <algorithm>#include <iostream>#include <iomanip>#include <limits.h>#include <map>#include <queue>#include <set>#include <string.h>#include <vector>using namespace std;typedef long long ll;int main() {int N;string S;cin >> N;cin >> S;int ans = 0;for (int i = 0; i < N; ++i) {for (int j = i + 1; j < N; ++j) {int k = 2 * j - i;if (S[i] == 'U' && S[j] == 'M' && S[k] == 'G') {++ans;}}}cout << ans << endl;return 0;}