結果
| 問題 |
No.1218 Something Like a Theorem
|
| コンテスト | |
| ユーザー |
akoba
|
| 提出日時 | 2021-01-29 16:33:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 740 bytes |
| コンパイル時間 | 658 ms |
| コンパイル使用メモリ | 68,880 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-27 03:42:22 |
| 合計ジャッジ時間 | 1,408 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 16 |
ソースコード
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
using INT = unsigned long long;
INT _pow(INT a, INT b)
{
INT c = a;
while (--b > 0) {
c *= a;
}
return c;
}
const char *solve(INT n, INT z)
{
const INT A = pow(z, n);
INT x, y;
x = 1;
while (1) {
y = 1;
while (1) {
INT a = _pow(x, n) + _pow(y, n);
if (a == A) {
return "Yes";
}
if (a > A) {
if (y == 1) {
return "No";
}
break;
}
y++;
}
x++;
}
}
int main()
{
INT n, z;
cin >> n >> z;
cout << solve(n, z) << endl;
}
akoba