結果
問題 | No.2954 Calculation of Exponentiation |
ユーザー |
👑 |
提出日時 | 2024-05-21 16:00:16 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 514 bytes |
コンパイル時間 | 1,883 ms |
コンパイル使用メモリ | 193,320 KB |
最終ジャッジ日時 | 2025-02-21 16:24:39 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include<bits/stdc++.h>#define rep(i,n) for(int i=0;i<n;i++)using namespace std;int solve(){long double _a;long double _b;cin >> _a >> _b;if(_b == 0){cout << "Yes" << "\n";return 0;}if(_b < 0){_a = 1 / _a;_b *= -1;}int i = int(_b);_b -= i;if(_b < 0.000001) _b += 1;long double c = pow(_a, _b);long long x = round(c);if(abs(c - x) < 0.0000000001) cout << "Yes" << "\n";else cout << "No" << "\n";return 0;}int main(){solve();return 0;}