結果
| 問題 |
No.2954 Calculation of Exponentiation
|
| コンテスト | |
| ユーザー |
Today03
|
| 提出日時 | 2024-11-08 21:41:49 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 838 bytes |
| コンパイル時間 | 2,763 ms |
| コンパイル使用メモリ | 253,344 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-08 21:42:03 |
| 合計ジャッジ時間 | 3,639 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 WA * 5 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9 + 10;
const ll INFL = 4e18;
int main() {
string A, B;
cin >> A >> B;
int dot = ranges::find(A, '.') - A.begin();
if (A.substr(dot) != ".0000") return puts("No"), 0;
A.resize(dot);
int a = stoi(A);
vector<ll> pf;
for (int i = 2; i * i <= a; i++) {
if (a % i) continue;
int cnt = 0;
while (a % i == 0) {
a /= i;
cnt++;
}
pf.push_back(cnt);
}
if (a > 1) pf.push_back(1);
B.erase(ranges::find(B, '.'));
ll bup = stoll(B), blo = 10000;
ll g = gcd(bup, blo);
bup /= g;
blo /= g;
for (ll &p : pf) p *= bup;
bool ans = true;
for (ll p : pf) {
if (p % blo) ans = false;
}
puts(ans ? "Yes" : "No");
}
Today03