結果

問題 No.1218 Something Like a Theorem
ユーザー msm1993msm1993
提出日時 2020-10-08 10:23:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 539 bytes
コンパイル時間 1,574 ms
コンパイル使用メモリ 164,528 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-27 11:45:43
合計ジャッジ時間 3,408 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 64 ms
4,376 KB
testcase_07 AC 65 ms
4,376 KB
testcase_08 AC 64 ms
4,376 KB
testcase_09 AC 64 ms
4,376 KB
testcase_10 AC 64 ms
4,376 KB
testcase_11 AC 64 ms
4,384 KB
testcase_12 AC 64 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0