結果

問題 No.380 悪の台本
ユーザー jp_stejp_ste
提出日時 2016-08-06 18:39:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 599 ms / 1,000 ms
コード長 1,408 bytes
コンパイル時間 2,218 ms
コンパイル使用メモリ 77,392 KB
実行使用メモリ 54,420 KB
最終ジャッジ日時 2024-04-24 14:43:49
合計ジャッジ時間 5,851 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
41,264 KB
testcase_01 AC 142 ms
41,764 KB
testcase_02 AC 132 ms
41,508 KB
testcase_03 AC 131 ms
41,164 KB
testcase_04 AC 344 ms
47,904 KB
testcase_05 AC 470 ms
47,376 KB
testcase_06 AC 387 ms
48,320 KB
testcase_07 AC 599 ms
54,420 KB
testcase_08 AC 264 ms
44,844 KB
testcase_09 AC 354 ms
48,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    
    static Scanner scan = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        String names[] = { "digi", "petit", "rabi", "gema", "piyo" };
        
        String reges[] = new String[5];
        reges[0] = "digi .*[nN][yY][oO][ -/:-@\\[-\\`\\{-\\~]{0,3}$";
        reges[1] = "petit .*[nN][yY][uU][ -/:-@\\[-\\`\\{-\\~]{0,3}$";
        reges[2] = "rabi .*[a-z0-9A-Z].*";
        reges[3] = "gema .*[gG][eE][mM][aA][ -/:-@\\[-\\`\\{-\\~]{0,3}$";
        reges[4] = "piyo .*[pP][yY][oO][ -/:-@\\[-\\`\\{-\\~]{0,3}$";
        
        while(scan.hasNextLine()) {
            String line = scan.nextLine();
            String name = line.split(" ")[0];
            String str = "WRONG!";
            
            for(int i=0; i<names.length; i++) {
                if(name.equals(names[i])) {
                    Pattern p = Pattern.compile(reges[i]);
                    Matcher m = p.matcher(line);
                    if(m.find()) {
                        str = "CORRECT (maybe)";
                    }
                    break;
                }
            }
            out.println(str);
        }
        out.flush();
    }
}
0