結果
| 問題 |
No.2954 Calculation of Exponentiation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-08 22:12:48 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,379 bytes |
| コンパイル時間 | 6,550 ms |
| コンパイル使用メモリ | 307,620 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-08 22:13:08 |
| 合計ジャッジ時間 | 7,253 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
const ll MOD = 998244353;
const double INFD = 1.0E10;
const int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
using Pair = pair<ll, ll>;
using Graph = vector<vector<int>>;
using mint = atcoder::modint998244353;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(15);
double a, b; cin >> a >> b;
if (b == 0) cout << "Yes" << endl;
else {
ll x = a * 10000;
if (b < 0){
x = 1.0 / a * 1'000'000'000;
if (x % 100'000 != 0){
cout << "No" << endl;
return 0;
}
x /= 100'000;
b *= -1;
}
if (x % 10000 == 0){
x /= 10000;
ll y = x;
ll m = INF;
//cout << x << endl;
for (int i = 2; i <= y; i++){
ll cnt = 0;
while (x % i == 0){
x /= i;
cnt++;
}
if (cnt) m = min(m, cnt);
}
//cout << m << endl;
cout << (ll(m * b * 10000) % 10000 == 0 ? "Yes" : "No") << endl;
}
else cout << "No" << endl;
}
return 0;
}