結果
問題 |
No.1250 汝は倍数なりや?
|
ユーザー |
![]() |
提出日時 | 2020-11-25 22:54:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 621 bytes |
コンパイル時間 | 3,003 ms |
コンパイル使用メモリ | 198,568 KB |
最終ジャッジ日時 | 2025-01-16 05:42:18 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 WA * 1 TLE * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int N,H; cin>>N>>H; int temp; map<int,int>mp; map<int,int>np; for(int i=0;i<N;i++){ cin>>temp; if(temp==1) continue; if(temp<0) temp*=-1; for(int j=2;j<=temp;j++){ if(temp%j==0){ mp[j]++; temp/=j; j--; } } } temp=H; for(int i=2;i<=H;i++){ if(temp%i==0){ np[i]++; temp/=i; i--; } } for(auto itr=np.begin();itr !=np.end();itr++){ if(mp[(itr->first)]<itr->second){ cout<<"NO"<<endl; return 0; } } cout<<"YES"<<endl; return 0; }