結果

問題 No.380 悪の台本
ユーザー hiromi_ayasehiromi_ayase
提出日時 2016-06-17 22:47:35
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 1,216 bytes
コンパイル時間 2,176 ms
コンパイル使用メモリ 77,204 KB
実行使用メモリ 47,652 KB
最終ジャッジ日時 2024-04-24 14:14:53
合計ジャッジ時間 5,252 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 127 ms
41,348 KB
testcase_03 AC 127 ms
41,276 KB
testcase_04 AC 293 ms
44,648 KB
testcase_05 AC 426 ms
47,412 KB
testcase_06 AC 412 ms
47,652 KB
testcase_07 WA -
testcase_08 AC 227 ms
42,968 KB
testcase_09 AC 312 ms
46,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	private static boolean[] isMark = new boolean[256];

	static {
		for (int i = 0; i < 256; i++) {
			if ('0' <= i && i <= '9' || 'a' <= i && i <= 'z' || 'A' <= i && i <= 'Z') {
			} else {
				isMark[i] = true;
			}
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			String name = sc.next();
			String line = sc.nextLine().toLowerCase();
			boolean ok = false;
			if (name.equals("digi")) {
				line = trim(line);
				ok = line.endsWith("nyo");
			} else if (name.equals("petit")) {
				line = trim(line);
				ok = line.endsWith("nyu");
			} else if (name.equals("gema")) {
				line = trim(line);
				ok = line.endsWith("gema");
			} else if (name.equals("piyo")) {
				line = trim(line);
				ok = line.endsWith("pyo");
			} else if (name.equals("rabi")) {
				for (char c : line.toCharArray()) {
					if (!isMark[c]) {
						ok = true;
						break;
					}
				}
			}
			System.out.println(ok ? "CORRECT (maybe)" : "WRONG!");
		}
	}

	private static String trim(String s) {
		for (int i = 0; i < 3 && isMark[s.charAt(s.length() - 1)]; i++) {
			s = s.substring(0, s.length() - 1);
		}
		return s;
	}

}
0