結果

問題 No.1395 Less Sweet Alchemy
ユーザー kaede2020
提出日時 2021-02-14 21:28:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 512 bytes
コンパイル時間 1,591 ms
コンパイル使用メモリ 169,660 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-22 08:46:26
合計ジャッジ時間 2,079 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

int main(){
  int n,x;
  cin>>n>>x;
  vector<int>c(n);
  int dai=0,sho=1000;
  int num=0;
  rep(i,n){
    cin>>c[i];
    dai=max(dai,c[i]);
    sho=min(sho,c[i]);
    num=gcd(num,c[i]);
  }
  if(x>dai)cout<<"No"<<endl;
  else if(x<sho)cout<<"No"<<endl;
  else{
    if(x%num==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}
0