結果

問題 No.2714 Amaou
ユーザー tomoya
提出日時 2024-05-23 01:34:20
言語 Java
(openjdk 23)
結果
AC  
実行時間 176 ms / 2,000 ms
コード長 1,180 bytes
コンパイル時間 2,239 ms
コンパイル使用メモリ 75,032 KB
実行使用メモリ 54,312 KB
最終ジャッジ日時 2024-12-20 18:44:40
合計ジャッジ時間 7,790 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int amaouCount = 0;

        for (int i = 0; i < N; i++) {
            String[] features = new String[4];
            for (int j = 0; j < 4; j++) {
                features[j] = sc.next();
            }

            if (containsAllFeatures(features)) {
                amaouCount++;
            }
        }

        System.out.println(amaouCount);
    }

    private static boolean containsAllFeatures(String[] features) {
        boolean akai = false, marui = false, okii = false, umai = false;
        for (String feature : features) {
            switch (feature) {
                case "akai":
                    akai = true;
                    break;
                case "marui":
                    marui = true;
                    break;
                case "okii":
                    okii = true;
                    break;
                case "umai":
                    umai = true;
                    break;
            }
        }
        return akai && marui && okii && umai;
    }
}
0