結果
問題 | No.805 UMG |
ユーザー |
![]() |
提出日時 | 2019-03-22 21:35:33 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 352 bytes |
コンパイル時間 | 405 ms |
コンパイル使用メモリ | 55,596 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-18 13:15:59 |
合計ジャッジ時間 | 1,327 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <iostream> #include <string> using namespace std; int N; string S; int main(){ cin >> N >> S; int r=0; for(int i=0; i<N; i++){ if(S[i]!='U')continue; for(int j=i+1; j<N; j++){ int k=j*2-i; if(k>=N)continue; if(S[j]=='M' && S[k]=='G')r++; } } cout << r << "\n"; }