結果
問題 | No.1218 Something Like a Theorem |
ユーザー |
👑 ![]() |
提出日時 | 2020-09-28 19:53:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 539 bytes |
コンパイル時間 | 1,483 ms |
コンパイル使用メモリ | 168,340 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-02 10:26:14 |
合計ジャッジ時間 | 2,614 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 16 |
ソースコード
#include<bits/stdc++.h>using namespace std;using LL = long long;using ULL = unsigned long long;#define rep(i,n) for(int i=0; i<(n); i++)int main() {int N, z; cin >> N >> z;bool ok = false;if (N == 1) { if (z >= 2) ok = true; }else {int Z = 1; rep(i, N) Z *= z;for (int x = 1; x <= pow(2.e6, 1. / N); x++) {for (int y = x; y <= pow(2.e6, 1. / N); y++) {int X = 1; rep(i, N) X *= x;int Y = 1; rep(i, N) Y *= y;if (X + Y == Z) ok = true;}}}cout << (ok ? "Yes" : "No") << endl;return 0;}