結果
問題 |
No.805 UMG
|
ユーザー |
![]() |
提出日時 | 2021-03-08 20:18:04 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 428 bytes |
コンパイル時間 | 1,981 ms |
コンパイル使用メモリ | 192,208 KB |
最終ジャッジ日時 | 2025-01-19 12:57:54 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 TLE * 5 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<n;i++) typedef pair<int,int>P; int main(){ int n; cin>>n; string s; cin>>s; int cnt=0; rep(i,n){ if(s.at(i) !='U') continue; for(int j=i+1;j<n;j++){ if(s.at(j) !='M') continue; for(int k=j+1;k<n;k++){ if(s.at(k)=='G' && j-i==k-j) cnt++; } } } cout<<cnt<<endl; return 0; }