結果
| 問題 |
No.805 UMG
|
| コンテスト | |
| ユーザー |
r1825
|
| 提出日時 | 2019-03-22 21:28:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 23 ms / 2,000 ms |
| コード長 | 461 bytes |
| コンパイル時間 | 1,691 ms |
| コンパイル使用メモリ | 167,364 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-18 13:13:49 |
| 合計ジャッジ時間 | 2,675 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int cnt;
signed main () {
int n;
string s;
cin >> n >> s;
for ( int i = 1; i <= n; i++ ) {
if ( s[i-1] != 'U' ) continue;
for ( int j = i+1; j <= n; j++ ) {
if ( s[j-1] != 'M' ) continue;
int k = j*2 - i;
if ( j < k && k <= n ) {
if ( s[k-1] == 'G' ) cnt++;
}
}
}
cout << cnt << endl;
return 0;
}
r1825