結果

問題 No.1250 汝は倍数なりや?
ユーザー kusagame12
提出日時 2023-11-06 18:35:11
言語 Java
(openjdk 23)
結果
AC  
実行時間 829 ms / 1,000 ms
コード長 628 bytes
コンパイル時間 2,644 ms
コンパイル使用メモリ 75,312 KB
実行使用メモリ 54,608 KB
最終ジャッジ日時 2024-09-25 23:06:33
合計ジャッジ時間 21,810 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 49
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int h = sc.nextInt();
        int[] as = new int[n];
       
        long data = 1l;
        if(h == 1){
            System.out.println("YES");
            return;
        }
        for(int i = 0 ; i < n ; i++){
            
            int a = sc.nextInt();
            
            data = (data % h) * (a % h);
            
        }
       
        System.out.println(data % h == 0 ? "YES" : "NO");
        
    }
   
}

0