結果
問題 | No.805 UMG |
ユーザー | erbowl |
提出日時 | 2019-03-22 21:29:06 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 34 ms / 2,000 ms |
コード長 | 657 bytes |
コンパイル時間 | 1,315 ms |
コンパイル使用メモリ | 158,552 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-18 13:14:10 |
合計ジャッジ時間 | 2,022 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
typedef long long ll; #include <bits/stdc++.h> using namespace std; template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ std::fill( (T*)array, (T*)(array+N), val ); } int main() { ll n; string s; std::cin >> n; ll result = 0; std::cin >> s; for (int i =1; i <= n/2; i++) { for (int j = 0; j < n; j++) { ll c1,c2,c3; c1 = j; c2 = j+i; c3 = j+2*i; if(j+2*i>n-1)break; if( s[c1] == 'U' && s[c2] == 'M' && s[c3] == 'G'){ result++; } } } std::cout << result << std::endl; }