結果
| 問題 |
No.805 UMG
|
| コンテスト | |
| ユーザー |
pengin_2000
|
| 提出日時 | 2020-02-20 17:42:47 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 280 bytes |
| コンパイル時間 | 109 ms |
| コンパイル使用メモリ | 29,440 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-18 13:58:54 |
| 合計ジャッジ時間 | 905 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include<stdio.h>
int main()
{
int n;
scanf("%d", &n);
char s[5003];
scanf("%s", s);
int i, j;
int ans = 0;
for (i = 0; i < n; i++)
for (j = i + 1; 2 * j - i < n; j++)
if (s[i] == 'U' && s[j] == 'M' && s[2 * j - i] == 'G')
ans++;
printf("%d\n", ans);
return 0;
}
pengin_2000