結果
| 問題 |
No.805 UMG
|
| コンテスト | |
| ユーザー |
sasa
|
| 提出日時 | 2025-03-18 17:57:20 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 2,000 ms |
| コード長 | 300 bytes |
| コンパイル時間 | 256 ms |
| コンパイル使用メモリ | 27,776 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-18 17:57:21 |
| 合計ジャッジ時間 | 1,540 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d", &val);
| ~~~~~^~~~~~~~~~~~
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%s", str);
| ~~~~~^~~~~~~~~~~
ソースコード
#include<stdio.h>
int main()
{
int val;
scanf("%d", &val);
char str[5003];
scanf("%s", str);
int ans = 0;
for (int i = 0; i < val; i++){
for (int j = i + 1; 2 * j - i < val; j++){
if (str[i] == 'U' && str[j] == 'M' && str[2 * j - i] == 'G'){
ans++;
}
}
}
printf("%d\n", ans);
}
sasa