結果
問題 | No.805 UMG |
ユーザー |
|
提出日時 | 2019-04-04 22:48:26 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 15 ms / 2,000 ms |
コード長 | 337 bytes |
コンパイル時間 | 2,603 ms |
コンパイル使用メモリ | 118,376 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-18 13:39:02 |
合計ジャッジ時間 | 1,610 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <iostream> char S[5001]; short n, i, j; int res = 0; int main(void){ scanf("%hd\n%s",&n, S); for(i = 0; i <= n - 1; i++){ if(S[i] == 'U'){ const short edge = (n-1-i) / 2; for(j = 1; j <= edge; j++){ if(S[i+j] == 'M' and S[i+j*2] == 'G') res++; } } } printf("%d\n", res); return 0; }