結果
| 問題 | No.805 UMG |
| コンテスト | |
| ユーザー |
horiesiniti
|
| 提出日時 | 2023-01-18 16:57:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 2,000 ms |
| コード長 | 310 bytes |
| コンパイル時間 | 495 ms |
| コンパイル使用メモリ | 64,836 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-11 17:46:04 |
| 合計ジャッジ時間 | 1,485 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
string s;
cin>>n>>s;
long long int ans=0;
for(int i=0;i<n;i++){
if(s[i]!='U')continue;
for(int j=1;j<n;j++){
if(i+j*2>=n)break;
if(s[i+j]=='M' && s[i+j*2]=='G'){
ans++;
}
}
}
cout<<ans<<endl;
return 0;
}
horiesiniti