結果
| 問題 |
No.2954 Calculation of Exponentiation
|
| コンテスト | |
| ユーザー |
eve__fuyuki
|
| 提出日時 | 2024-11-08 23:18:36 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 757 bytes |
| コンパイル時間 | 2,150 ms |
| コンパイル使用メモリ | 199,656 KB |
| 最終ジャッジ日時 | 2025-02-25 03:11:39 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 WA * 5 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
void fast_io() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
int main() {
fast_io();
string a, b;
cin >> a >> b;
int n = a.size(), m = b.size();
if (a.substr(n - 5, 5) != ".0000") {
cout << "No" << endl;
return 0;
}
int A = stoi(a.substr(0, n - 5));
vector<pair<int, int>> pf;
for (int i = 2; i * i <= A; i++) {
if (A % i == 0) {
int cnt = 0;
while (A % i == 0) {
A /= i;
cnt++;
}
pf.push_back({i, cnt});
}
}
if (A > 1) {
pf.push_back({A, 1});
}
int r = stoi(b.substr(0, m - 5) + b.substr(m - 4, 4));
int s = 10000 / gcd(r, 10000);
for (auto [_, cnt] : pf) {
if (cnt % s != 0) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
}
eve__fuyuki