結果

問題 No.380 悪の台本
ユーザー GrenacheGrenache
提出日時 2017-01-25 11:36:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 596 ms / 1,000 ms
コード長 5,066 bytes
コンパイル時間 3,939 ms
コンパイル使用メモリ 78,168 KB
実行使用メモリ 56,132 KB
最終ジャッジ日時 2024-11-06 23:21:42
合計ジャッジ時間 6,199 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
37,208 KB
testcase_01 AC 55 ms
37,040 KB
testcase_02 AC 55 ms
37,224 KB
testcase_03 AC 54 ms
37,240 KB
testcase_04 AC 162 ms
41,100 KB
testcase_05 AC 234 ms
42,596 KB
testcase_06 AC 228 ms
41,856 KB
testcase_07 AC 596 ms
56,132 KB
testcase_08 AC 102 ms
41,468 KB
testcase_09 AC 184 ms
40,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;


public class Main_yukicoder380 {

    public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

//        Scanner sc = new Scanner(System.in);

        while (true) {
        	String s;
			try {
				s = br.readLine();
			} catch (IOException e) {
				throw new IllegalStateException();
			}

//        	String s = sc.nextLine();
        	if (s == null) {
        		break;
        	}
        	String ss = s.toLowerCase();

//        	System.out.println(s);

        	if (s.startsWith("digi ")) {
        		ss = ss.substring("digi ".length());
        		if (ss.endsWith("nyo")) {
        			System.out.println("CORRECT (maybe)");
        			continue;
        		}
        		if (ss.length() > 1 && !isOK(ss.charAt(ss.length() - 1))) {
        			ss = ss.substring(0, ss.length() - 1);
        		}
        		if (ss.endsWith("nyo")) {
        			System.out.println("CORRECT (maybe)");
        			continue;
        		}
        		if (ss.length() > 1 && !isOK(ss.charAt(ss.length() - 1))) {
        			ss = ss.substring(0, ss.length() - 1);
        		}
        		if (ss.endsWith("nyo")) {
        			System.out.println("CORRECT (maybe)");
        			continue;
        		}
        		if (ss.length() > 1 && !isOK(ss.charAt(ss.length() - 1))) {
        			ss = ss.substring(0, ss.length() - 1);
        		}
        		if (ss.endsWith("nyo")) {
        			System.out.println("CORRECT (maybe)");
        			continue;
        		}
        	} else if (s.startsWith("petit ")) {
        		ss = ss.substring("petit ".length());
        		if (ss.endsWith("nyu")) {
        			System.out.println("CORRECT (maybe)");
        			continue;
        		}
        		if (ss.length() > 1 && !isOK(ss.charAt(ss.length() - 1))) {
        			ss = ss.substring(0, ss.length() - 1);
        		}
        		if (ss.endsWith("nyu")) {
        			System.out.println("CORRECT (maybe)");
        			continue;
        		}
        		if (ss.length() > 1 && !isOK(ss.charAt(ss.length() - 1))) {
        			ss = ss.substring(0, ss.length() - 1);
        		}
        		if (ss.endsWith("nyu")) {
        			System.out.println("CORRECT (maybe)");
        			continue;
        		}
        		if (ss.length() > 1 && !isOK(ss.charAt(ss.length() - 1))) {
        			ss = ss.substring(0, ss.length() - 1);
        		}
        		if (ss.endsWith("nyu")) {
        			System.out.println("CORRECT (maybe)");
        			continue;
        		}
        	} else if (s.startsWith("rabi ")) {
        		ss = ss.substring("rabi ".length());
        		boolean flag = false;
        		for (char c : ss.toCharArray()) {
        			if (isOK(c)) {
        				flag = true;
        				break;
        			}
        		}

        		if (flag) {
        			System.out.println("CORRECT (maybe)");
        			continue;
        		}
        	} else if (s.startsWith("gema ")) {
        		ss = ss.substring("gema ".length());
        		if (ss.endsWith("gema")) {
        			System.out.println("CORRECT (maybe)");
        			continue;
        		}
        		if (ss.length() > 1 && !isOK(ss.charAt(ss.length() - 1))) {
        			ss = ss.substring(0, ss.length() - 1);
        		}
        		if (ss.endsWith("gema")) {
        			System.out.println("CORRECT (maybe)");
        			continue;
        		}
        		if (ss.length() > 1 && !isOK(ss.charAt(ss.length() - 1))) {
        			ss = ss.substring(0, ss.length() - 1);
        		}
        		if (ss.endsWith("gema")) {
        			System.out.println("CORRECT (maybe)");
        			continue;
        		}
        		if (ss.length() > 1 && !isOK(ss.charAt(ss.length() - 1))) {
        			ss = ss.substring(0, ss.length() - 1);
        		}
        		if (ss.endsWith("gema")) {
        			System.out.println("CORRECT (maybe)");
        			continue;
        		}
        	} else if (s.startsWith("piyo ")) {
        		ss = ss.substring("piyo ".length());
        		if (ss.endsWith("pyo")) {
        			System.out.println("CORRECT (maybe)");
        			continue;
        		}
        		if (ss.length() > 1 && !isOK(ss.charAt(ss.length() - 1))) {
        			ss = ss.substring(0, ss.length() - 1);
        		}
        		if (ss.endsWith("pyo")) {
        			System.out.println("CORRECT (maybe)");
        			continue;
        		}
        		if (ss.length() > 1 && !isOK(ss.charAt(ss.length() - 1))) {
        			ss = ss.substring(0, ss.length() - 1);
        		}
        		if (ss.endsWith("pyo")) {
        			System.out.println("CORRECT (maybe)");
        			continue;
        		}
        		if (ss.length() > 1 && !isOK(ss.charAt(ss.length() - 1))) {
        			ss = ss.substring(0, ss.length() - 1);
        		}
        		if (ss.endsWith("pyo")) {
        			System.out.println("CORRECT (maybe)");
        			continue;
        		}
        	}
    		System.out.println("WRONG!");
        }

//        sc.close();
    }

	private static boolean isOK(char ch) {
		if (ch >= '0' && ch <= '9') {
			return true;
		}
		if (ch >= 'a' && ch <= 'z') {
			return true;
		}
		if (ch >= 'A' && ch <= 'Z') {
			return true;
		}

		return false;
	}
}
0