結果

問題 No.24 数当てゲーム
ユーザー yoshykaiyoshykai
提出日時 2020-12-03 18:26:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 45 ms / 5,000 ms
コード長 2,685 bytes
コンパイル時間 2,006 ms
コンパイル使用メモリ 75,392 KB
実行使用メモリ 50,184 KB
最終ジャッジ日時 2023-10-12 04:37:47
合計ジャッジ時間 3,051 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,788 KB
testcase_01 AC 42 ms
49,740 KB
testcase_02 AC 44 ms
49,876 KB
testcase_03 AC 44 ms
49,672 KB
testcase_04 AC 43 ms
50,184 KB
testcase_05 AC 43 ms
49,788 KB
testcase_06 AC 45 ms
50,108 KB
testcase_07 AC 43 ms
49,620 KB
testcase_08 AC 43 ms
49,944 KB
testcase_09 AC 43 ms
49,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
class Main{
  public static void main(String args[]){
    int n=readI();
    boolean flg[]=new boolean[10];
    for(int i=0;i<10;i++){flg[i]=true;}
    for(int i=0;i<n;i++){
      int a=readI(),b=readI(),c=readI(),d=readI();
      String str = readS();
      if(str.charAt(0)=='N'){
        flg[a]=false;flg[b]=false;flg[c]=false;flg[d]=false;
      }else{
        for(int j=0;j<10;j++){
          if(j!=a&&j!=b&&j!=c&&j!=d){
            flg[j]=false;
          }
        }
      }
    }
    for(int i=0;i<10;i++){
      if(flg[i]){
        pl(i+"");
        break;
      }
    }
  }

  static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  public static void pr(String str){
    System.out.print(str);
  }
  public static void pl(String str){
    System.out.println(str);
  }
  public static String read(){
    try{
      return ctos((char)br.read());
    }catch(IOException e){
      e.printStackTrace();
      return "";
    }
  }
  public static char readC(){
    try{
      return (char)br.read();
    }catch(IOException e){
      e.printStackTrace();
      return (char)-1;
    }
  }
  public static String readL(){
    try{
      return br.readLine();
    }catch(IOException e){
      e.printStackTrace();
      return "";
    }
  }
  public static String readS(){
    StringBuilder sb = new StringBuilder();
    while(true){
      try{
        int k = br.read();
        if(k==-1||(char)k==' '||(char)k=='\n'){break;}
        sb.append((char)k);
      }catch(IOException e){
        e.printStackTrace();
      }
    }
    return sb.toString();
  }
  public static int readI(){
    return stoi(readS());
  }
  public static long readLong(){
    return stol(readS());
  }
  public static long stol(String s){
    return Long.parseLong(s);
  }
  public static String[] readSs(){
    return readL().split(" ");
  }
  public static int[] readIs(){
    return stoi(readSs());
  }
  public static int stoi(String s){
    return Integer.parseInt(s);
  }
  public static int[] stoi(String s[]){
    int a[]=new int[s.length];
    for(int i=0;i<s.length;i++){
      a[i]=stoi(s[i]);
    }
    return a;
  }
  public static String itos(int i){
    return String.valueOf(i);
  }
  public static String[] itos(int[] a){
    String s[]=new String[a.length];
    for(int i=0;i<a.length;i++){
      s[i]=itos(a[i]);
    }
    return s;
  }
  public static String ctos(char c){
    return String.valueOf(c);
  }
  public static String cstos(char[] c){
    return new String(c);
  }
  public static char stoc(String s){
    return s.charAt(0);
  }
  public static char[] stocs(String s){
    return s.toCharArray();
  }
}
0