結果

問題 No.1556 Power Equality
ユーザー ぷら
提出日時 2021-06-29 10:11:53
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 428 bytes
コンパイル時間 2,075 ms
コンパイル使用メモリ 191,008 KB
最終ジャッジ日時 2025-01-22 14:53:41
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int A,B;
    cin >> A >> B;
    int tmp = B/A;
    int tmp2 = 1;
    if(A == 1 && B != 1) {
        cout << "No" << endl;
        return 0;
    }
    for(int i = 0; i < tmp; i++) {
        tmp2 *= A;
        if(tmp2 > B) {
            break;
        }
    }
    if(tmp2 == B) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}
0