結果

問題 No.380 悪の台本
ユーザー ym678ym678
提出日時 2016-08-31 19:04:15
言語 Java21
(openjdk 21)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,029 bytes
コンパイル時間 2,180 ms
コンパイル使用メモリ 74,368 KB
実行使用メモリ 53,852 KB
最終ジャッジ日時 2024-04-24 14:46:00
合計ジャッジ時間 6,819 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
41,164 KB
testcase_01 AC 151 ms
41,620 KB
testcase_02 AC 130 ms
41,552 KB
testcase_03 AC 114 ms
40,204 KB
testcase_04 AC 413 ms
48,076 KB
testcase_05 AC 642 ms
47,832 KB
testcase_06 AC 619 ms
47,672 KB
testcase_07 TLE -
testcase_08 AC 235 ms
42,820 KB
testcase_09 AC 452 ms
48,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.regex.Pattern;
import java.util.regex.Matcher;;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] check = new String[5];
		check[0] = "digi .*[nN][yY][oO]([^a-zA-Z0-9]{0,3})$";
		check[1] = "petit .*[nN][yY][uU]([^a-zA-Z0-9]{0,3})$";
		check[2] = "rabi .*[a-zA-Z0-9].*";
		check[3] = "gema .*[gG][eE][mM][aA]([^a-zA-Z0-9]{0,3})$";
		check[4] = "piyo .*[pP][yY][oO]([^a-zA-Z0-9]{0,3})$";
		
		
		boolean flag = false;
		while(sc.hasNextLine()){
			String line = sc.nextLine();
			if(line.indexOf(' ') == -1){
				System.out.println("WRONG!");
				continue;
			}
			
			for(int i=0; i<5; i++){
				Pattern p = Pattern.compile(check[i]);
				Matcher m = p.matcher(line);
				boolean b = m.matches();
			    if(b){
			    	flag = true;
			        System.out.println("CORRECT (maybe)");
			        break;
			    }			
			}
			if(!flag){
			    System.out.println("WRONG!");
			}else{
				flag = false;
			}
		}
		sc.close();
	}
}
0