結果

問題 No.418 ミンミンゼミ
ユーザー YamaKasaYamaKasa
提出日時 2018-05-05 17:11:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 1,000 ms
コード長 532 bytes
コンパイル時間 2,446 ms
コンパイル使用メモリ 71,208 KB
実行使用メモリ 57,676 KB
最終ジャッジ日時 2023-09-23 02:09:29
合計ジャッジ時間 6,233 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,648 KB
testcase_01 AC 121 ms
55,728 KB
testcase_02 AC 118 ms
55,912 KB
testcase_03 AC 119 ms
55,708 KB
testcase_04 AC 119 ms
55,880 KB
testcase_05 AC 118 ms
55,848 KB
testcase_06 AC 122 ms
56,016 KB
testcase_07 AC 119 ms
55,820 KB
testcase_08 AC 119 ms
55,764 KB
testcase_09 AC 119 ms
55,816 KB
testcase_10 AC 119 ms
55,544 KB
testcase_11 AC 120 ms
55,728 KB
testcase_12 AC 120 ms
56,056 KB
testcase_13 AC 119 ms
56,300 KB
testcase_14 AC 119 ms
56,024 KB
testcase_15 AC 118 ms
55,916 KB
testcase_16 AC 118 ms
55,736 KB
testcase_17 AC 121 ms
56,052 KB
testcase_18 AC 116 ms
55,732 KB
testcase_19 AC 118 ms
57,676 KB
testcase_20 AC 118 ms
55,736 KB
testcase_21 AC 118 ms
55,620 KB
testcase_22 AC 123 ms
55,924 KB
testcase_23 AC 117 ms
55,276 KB
testcase_24 AC 118 ms
55,800 KB
testcase_25 AC 119 ms
55,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		scan.close();
		int cnt = 0;
		int ans = 0;
		for(int i = 0; i < S.length(); i++) {
			char c = S.charAt(i);
			if(cnt == 0 && c == 'm') {
				cnt ++;
			}else if(cnt == 1 && c == 'i') {
				cnt ++;
			}else if(cnt == 2 && c == 'n') {
				cnt ++;
				ans ++;
			}else if(cnt == 3) {
				cnt = 0;
				if(c == 'm') {
					cnt ++;
				}
			}
		}
		System.out.println(ans);
	}
}
0