結果
問題 |
No.2954 Calculation of Exponentiation
|
ユーザー |
|
提出日時 | 2024-11-08 22:31:30 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 744 bytes |
コンパイル時間 | 3,097 ms |
コンパイル使用メモリ | 245,380 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-08 22:31:38 |
合計ジャッジ時間 | 4,081 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 WA * 6 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { string A, B; cin >> A >> B; if(A.substr(A.size() - 4) != "0000") { cout << "No\n"; return 0; } if(B.substr(B.size() - 4) == "0000") { cout << "Yes\n"; return 0; } int integer = stoi(A.substr(0, A.size() - 5)); int decimal = stoi(B.substr(B.size() - 4)); for(long long i = 0; i <= 10000; i++) { if(i * decimal == 10000) { // A = j ^ iならよい for(long long j = 0; j <= integer; j++) { if(integer == pow(j, i)) { cout << "Yes\n"; return 0; } } } } cout << "No\n"; return 0; }