結果

問題 No.1250 汝は倍数なりや?
ユーザー ui_mtc
提出日時 2020-10-09 23:57:46
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 81 ms / 1,000 ms
コード長 511 bytes
コンパイル時間 1,698 ms
コンパイル使用メモリ 166,060 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-20 14:47:11
合計ジャッジ時間 3,877 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 49
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD =  1000000007;
const int INF = 1e11;
using Graph = vector<vector<int>>;

signed main(){
  int N, H;
  cin >> N >> H;

  bool fg = 0;
  int now = 1;
  for( int i = 0; i < N; i++ ){
    int A;
    cin >> A;
    if( A%H == 0 ) fg = 1;
    else now *= (A%H);
    if( abs(now) >= H ){
      if( now%H == 0 ) fg = 1;
      now %= H;
    }
  }
  if( fg ) cout << "YES" << endl;
  else cout << "NO" << endl;
}
0