結果
問題 |
No.380 悪の台本
|
ユーザー |
![]() |
提出日時 | 2016-06-17 22:40:55 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 952 bytes |
コンパイル時間 | 2,093 ms |
コンパイル使用メモリ | 74,960 KB |
実行使用メモリ | 65,436 KB |
最終ジャッジ日時 | 2024-11-06 22:36:18 |
合計ジャッジ時間 | 5,653 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 1 WA * 7 |
ソースコード
import java.io.IOException; import java.io.InputStream; import java.util.NoSuchElementException; import java.util.Scanner; public class Main { 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 = line.replaceAll("[^\\w]{0,3}$", ""); ok = line.endsWith("nyo"); } else if (name.equals("petit")) { line = line.replaceAll("[^\\w]{0,3}$", ""); ok = line.endsWith("nyu"); } else if (name.equals("gema")) { line = line.replaceAll("[^\\w]{0,3}$", ""); ok = line.endsWith("gema"); } else if (name.equals("piyo")) { line = line.replaceAll("[^\\w]{0,3}$", ""); ok = line.endsWith("pyo"); } else if (name.equals("rabi")) { ok = line.matches(".*[a-z].*"); } System.out.println(ok ? "CORRECT (maybe)" : "WRONG!"); } } }