結果
問題 |
No.805 UMG
|
ユーザー |
![]() |
提出日時 | 2019-03-26 01:20:09 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 510 bytes |
コンパイル時間 | 1,643 ms |
コンパイル使用メモリ | 167,232 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-18 13:35:00 |
合計ジャッジ時間 | 2,513 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long int MOD = (int)1e9 + 7; int INF = (int)2e18; // Comment out below and program paste // #include "UnionFind.hpp" // #include "power.hpp" signed main() { int N; cin >> N; string S; cin >> S; int ans = 0; for (int i = 1; i < N - 1; i++) { if (S[i] != 'M') continue; for (int j = 0; i - j >= 0; j++) { if (S[i - j] == 'U' && S[i + j] == 'G') ++ans; } } cout << ans << endl; }