結果

問題 No.418 ミンミンゼミ
ユーザー iicafiaxus
提出日時 2016-09-09 22:27:14
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 581 bytes
コンパイル時間 609 ms
コンパイル使用メモリ 119,232 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-12 04:14:47
合計ジャッジ時間 1,329 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

void main(){
	string s = readln.chomp;
	
	int flag = 0;
	int count = 0;
	foreach(c; s){
		if(flag == 0){
			if(c == 'm') flag = 1;
			else flag = 0;
			}
		else if(flag == 1){
			if(c == 'i') flag = 2;
			else if(c == 'm') flag = 1;
			else flag = 0;
			}
		else if(flag == 2){
			if(c == 'n') count += 1, flag = 0;
			else if(c == '-') {}
			else if(c == 'm') flag = 1;
			else flag = 0;
			}
		}
	
	int ans = count;
	ans.writeln;
	}
0