結果
| 問題 |
No.2954 Calculation of Exponentiation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-09 02:41:41 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 922 bytes |
| コンパイル時間 | 3,383 ms |
| コンパイル使用メモリ | 248,012 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-09 02:41:46 |
| 合計ジャッジ時間 | 4,664 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 2 |
ソースコード
#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;
}