結果
| 問題 |
No.418 ミンミンゼミ
|
| コンテスト | |
| ユーザー |
subsn
|
| 提出日時 | 2023-06-08 15:33:45 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 651 bytes |
| コンパイル時間 | 260 ms |
| コンパイル使用メモリ | 29,312 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-31 00:28:40 |
| 合計ジャッジ時間 | 1,167 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 25 |
ソースコード
#include <stdio.h>
#include <malloc.h>
char str[60000];
int str_len = 0;
/// <summary>
/// グローバル変数strの中身を入力された文字列で上書きする
/// </summary>
void ReadString() {
char c = getchar();
str_len = 0;
while (c != '\n') {
str[str_len] = c;
c = getchar();
str_len++;
}
}
int main()
{
ReadString();
int cnt = 0;
int stby = 0;
for (int i = 1;i < str_len;i++) {
if (str[i] == 'i' && str[i - 1] == 'm' && stby == 0) {
stby = 1;
continue;
}
if (stby == 1 && str[i] == 'n') {
cnt++;
stby = 0;
}
if (str[i] == '-') continue;
if (str[i] != 'n') stby = 0;
}
printf("%d\n", cnt);
}
subsn