結果

問題 No.380 悪の台本
コンテスト
ユーザー jp_ste
提出日時 2016-08-06 18:39:29
言語 Java
(openjdk 26.0.2.1 + ACL)
コンパイル:
javac -J-Duser.language=en -encoding UTF8 -cp /opt/aclib/ac_library.jar _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true -cp .:/opt/aclib/ac_library.jar _class_
結果
AC  
実行時間 316 ms / 1,000 ms
+ 959µs
コード長 1,408 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,382 ms
コンパイル使用メモリ 86,412 KB
実行使用メモリ 55,508 KB
最終ジャッジ日時 2026-09-19 20:54:37
合計ジャッジ時間 4,190 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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