結果
問題 | No.805 UMG |
ユーザー |
|
提出日時 | 2020-07-08 16:18:32 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 21 ms / 2,000 ms |
コード長 | 323 bytes |
コンパイル時間 | 2,867 ms |
コンパイル使用メモリ | 192,044 KB |
最終ジャッジ日時 | 2025-01-11 16:56:58 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ cin.tie(0),ios::sync_with_stdio(false); int n; string s; cin>>n>>s; int ans=0; for(int j=0;j<n;++j){ if(s.at(j)!='M')continue; for(int k=min(j*2,n-1);k>j;--k){ int i=j*2-k; if(s.at(i)!='U'||s.at(k)!='G')continue; ++ans; } } cout<<ans<<"\n"s; }