結果
問題 |
No.2954 Calculation of Exponentiation
|
ユーザー |
|
提出日時 | 2024-11-09 02:34:50 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 923 bytes |
コンパイル時間 | 3,595 ms |
コンパイル使用メモリ | 248,924 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-09 02:34:55 |
合計ジャッジ時間 | 4,265 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 7 |
ソースコード
#include<bits/stdc++.h> using namespace std; const long long INF = 1e18; vector<pair<long, int>> prime_fact(long N) { vector<pair<long, int>> primes; int n = N; for(long i=2; i*i<=N; i++) { if (n % i != 0) continue; int cnt = 0; while(n % i == 0) { cnt++; n /= i; } primes.push_back(make_pair(i, cnt)); } if (n != 1) primes.push_back(make_pair(n, 1)); return primes; } double A, B; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cin>>A>>B; long a = A * 10000; long b = B * 10000; vector<pair<long, int>> ps = prime_fact(A); bool ok = true; for(auto e:ps) { long ei = (e.first == 2 || e.first == 5) ? e.second - 4 : e.second; long eb = b * ei; if(!(eb >= 0 && eb % 10000 == 0)) { ok = false; } } cout<<(ok ? "Yes" : "No")<<endl; }