結果
| 問題 |
No.1250 汝は倍数なりや?
|
| コンテスト | |
| ユーザー |
mmn15277198
|
| 提出日時 | 2020-10-09 21:52:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 867 bytes |
| コンパイル時間 | 948 ms |
| コンパイル使用メモリ | 97,904 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-20 10:48:35 |
| 合計ジャッジ時間 | 2,905 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 6 WA * 43 |
ソースコード
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>
using namespace std;
using ll = long long;
using ull = unsigned long long;
ll mod = 1e9 + 7;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n , h;
cin >> n >> h;
vector<int> a(n);
for(int i = 0; i < n; i++){
cin >> a[i];
}
sort(a.begin() , a.end());
vector<int> v;
for(int i = 2; i * i <= h; i++){
if(h % i == 0){
while(h % i != 0){
h /= i;
v.push_back(i);
}
}
}
if(h != 1)v.push_back(h);
int cnt = 0;
for(int i = 0; i < v.size(); i++){
for(int j = 0; j < n; j++){
if(a[j] % v[i] == 0){
cnt++;
a[j] /= v[i];
break;
}
}
}
if(cnt == v.size()){
cout << "YES" << endl;
}else{
cout << "N0" << endl;
}
return 0;
}
mmn15277198