結果
問題 |
No.2954 Calculation of Exponentiation
|
ユーザー |
![]() |
提出日時 | 2024-11-08 21:46:46 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 872 bytes |
コンパイル時間 | 3,585 ms |
コンパイル使用メモリ | 253,484 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-08 21:47:06 |
合計ジャッジ時間 | 5,663 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 RE * 1 |
other | AC * 13 WA * 1 RE * 14 |
ソースコード
#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; if (A.substr(ranges::find(A, '.') - A.begin()) != ".0000") { assert(false); puts("No"); return 0; } A.resize(ranges::find(A, '.') - A.begin()); ll a = stoi(A); vector<ll> pf; for (int i = 2; i * i <= a; i++) { if (a % i != 0) 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; bool ans = true; for (ll p : pf) if ((p * bup) % blo != 0) ans = false; puts(ans ? "Yes" : "No"); }