結果

問題 No.380 悪の台本
ユーザー hiromi_ayasehiromi_ayase
提出日時 2016-06-17 22:52:37
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,234 bytes
コンパイル時間 2,329 ms
コンパイル使用メモリ 77,480 KB
実行使用メモリ 47,660 KB
最終ジャッジ日時 2024-04-24 14:16:04
合計ジャッジ時間 4,575 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
40,276 KB
testcase_01 WA -
testcase_02 AC 115 ms
41,256 KB
testcase_03 AC 115 ms
41,028 KB
testcase_04 AC 255 ms
44,776 KB
testcase_05 AC 377 ms
47,660 KB
testcase_06 AC 381 ms
47,560 KB
testcase_07 WA -
testcase_08 AC 204 ms
42,780 KB
testcase_09 AC 281 ms
46,404 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; s.length() > 0 && i < 3 && isMark[s.charAt(s.length() - 1)]; i++) {
			s = s.substring(0, s.length() - 1);
		}
		return s;
	}

}
0