結果

問題 No.1250 汝は倍数なりや?
ユーザー yoshykaiyoshykai
提出日時 2020-11-26 21:16:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 243 ms / 1,000 ms
コード長 2,363 bytes
コンパイル時間 2,119 ms
コンパイル使用メモリ 74,724 KB
実行使用メモリ 57,072 KB
最終ジャッジ日時 2023-10-01 03:31:19
合計ジャッジ時間 9,124 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,344 KB
testcase_01 AC 43 ms
47,640 KB
testcase_02 AC 43 ms
49,168 KB
testcase_03 AC 42 ms
49,272 KB
testcase_04 AC 42 ms
49,180 KB
testcase_05 AC 41 ms
49,180 KB
testcase_06 AC 41 ms
49,168 KB
testcase_07 AC 41 ms
49,800 KB
testcase_08 AC 42 ms
49,240 KB
testcase_09 AC 42 ms
49,444 KB
testcase_10 AC 42 ms
49,248 KB
testcase_11 AC 42 ms
49,328 KB
testcase_12 AC 42 ms
49,556 KB
testcase_13 AC 43 ms
49,532 KB
testcase_14 AC 44 ms
49,256 KB
testcase_15 AC 44 ms
49,300 KB
testcase_16 AC 46 ms
49,188 KB
testcase_17 AC 44 ms
49,380 KB
testcase_18 AC 43 ms
49,668 KB
testcase_19 AC 42 ms
49,360 KB
testcase_20 AC 44 ms
49,808 KB
testcase_21 AC 42 ms
49,340 KB
testcase_22 AC 42 ms
49,244 KB
testcase_23 AC 56 ms
50,280 KB
testcase_24 AC 56 ms
50,548 KB
testcase_25 AC 60 ms
51,680 KB
testcase_26 AC 52 ms
50,432 KB
testcase_27 AC 57 ms
50,588 KB
testcase_28 AC 53 ms
49,596 KB
testcase_29 AC 52 ms
49,944 KB
testcase_30 AC 60 ms
51,132 KB
testcase_31 AC 52 ms
50,168 KB
testcase_32 AC 61 ms
51,800 KB
testcase_33 AC 240 ms
57,072 KB
testcase_34 AC 199 ms
55,880 KB
testcase_35 AC 236 ms
56,392 KB
testcase_36 AC 237 ms
56,752 KB
testcase_37 AC 210 ms
56,540 KB
testcase_38 AC 197 ms
56,740 KB
testcase_39 AC 197 ms
55,868 KB
testcase_40 AC 205 ms
56,024 KB
testcase_41 AC 229 ms
56,408 KB
testcase_42 AC 179 ms
55,220 KB
testcase_43 AC 237 ms
56,576 KB
testcase_44 AC 172 ms
55,156 KB
testcase_45 AC 243 ms
56,520 KB
testcase_46 AC 163 ms
55,572 KB
testcase_47 AC 220 ms
56,624 KB
testcase_48 AC 41 ms
49,384 KB
testcase_49 AC 42 ms
49,384 KB
testcase_50 AC 42 ms
49,276 KB
testcase_51 AC 43 ms
49,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
class Main{
  public static void main(String args[])throws IOException{
    int n = readI(),h=readI();
    long l = 1;
    for(int i=0;i<n;i++){
        l*=readI();
        l=l%h;
    }
    if(l==0){
        pl("YES");   
    }else{
        pl("NO"); 
    }
  }

  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