結果
問題 |
No.805 UMG
|
ユーザー |
|
提出日時 | 2020-02-15 12:58:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 22 ms / 2,000 ms |
コード長 | 430 bytes |
コンパイル時間 | 1,523 ms |
コンパイル使用メモリ | 167,208 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-18 13:58:49 |
合計ジャッジ時間 | 2,411 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ int n;cin>>n; ll ans=0; string s;cin>>s; for(int i=0;i<n-2;i++){ for(int j=i;j<n-1;j++){ if(2*j-i>n-1){ break; } else{ if(s[i]=='U'&&s[j]=='M'&&s[2*j-i]=='G'){ ans++; } } } } cout<<ans<<endl; }