結果

問題 No.418 ミンミンゼミ
ユーザー daradara_sanma
提出日時 2018-04-30 14:08:21
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 561 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 57,692 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-16 02:34:33
合計ジャッジ時間 1,176 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%s", S);
      |         ~~~~~^~~~~~~~~

ソースコード

diff #

#include <iostream>
#include <string>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main() {
	char S[101];
	int count = 0, st = 0;

	scanf("%s", S);

	for (int i = 0; i <= strlen(S); i++)
	{
		switch (st)
		{
		case 0:
			if (S[i] == 'm') st++;
			break;
		case 1:
			if (S[i] == 'i') st++;
			else st = 0;
			break;
		case 2:
			while (S[i] == '-') i++;
			if (S[i] == 'n') st++;
			if (S[i+1] != 'n' && st == 3) count++;
			st = 0;
			break;
		default:
			printf("e");
			break;
		}
	}
	
	printf("%d\n", count);

	return 0;
}
0