結果
問題 | No.1218 Something Like a Theorem |
ユーザー |
|
提出日時 | 2020-09-04 22:09:09 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 120 ms / 2,000 ms |
コード長 | 613 bytes |
コンパイル時間 | 572 ms |
コンパイル使用メモリ | 68,096 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-26 12:58:21 |
合計ジャッジ時間 | 1,310 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 16 |
ソースコード
#include <iostream>#include <cmath>using namespace std;using ll = long long;int main(){int n;ll z;cin >> n >> z;if(n >= 3){cout << "No" << endl;return 0;}else{ll tmp = pow(z, n);for(ll x = 1; x < z; x++){ll y1 = tmp - pow(x, n);ll k = sqrt(y1);for(int i = -1; i <= 1; i++){if(k + i <= 0) continue;if(y1 == pow(k + i, n)){cout << "Yes" << endl;return 0;}}}cout << "No" << endl;}}