結果

問題 No.380 悪の台本
ユーザー jp_stejp_ste
提出日時 2016-08-06 18:55:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 440 ms / 1,000 ms
コード長 1,382 bytes
コンパイル時間 1,811 ms
コンパイル使用メモリ 74,460 KB
実行使用メモリ 53,316 KB
最終ジャッジ日時 2024-04-24 14:44:04
合計ジャッジ時間 4,790 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
40,080 KB
testcase_01 AC 102 ms
40,140 KB
testcase_02 AC 99 ms
40,004 KB
testcase_03 AC 109 ms
40,940 KB
testcase_04 AC 300 ms
47,816 KB
testcase_05 AC 427 ms
48,400 KB
testcase_06 AC 339 ms
47,580 KB
testcase_07 AC 440 ms
53,316 KB
testcase_08 AC 176 ms
43,068 KB
testcase_09 AC 295 ms
46,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;

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 str = "WRONG!";
            
            if(line.indexOf(" ") == -1) {
                out.println(str);
                continue;
            }
            String name = line.split(" ", 2)[0];
            
            for(int i=0; i<names.length; i++) {
                if(name.equals(names[i])) {
                    if(line.matches(reges[i])) {
                        str = "CORRECT (maybe)";
                    }
                    break;
                }
            }
            out.println(str);
        }
        out.flush();
    }
}
0