URAL 1349 Farm
阅读原文时间:2023年07月17日阅读:1

Discription

Here is a farm. Here is a farmer that counts how many animal live in his farm: a camels, b sheep, c green cockroaches. Occurs that a n + b n = c n. n is given. You are to find all the rest.

Input

n (0 ≤ n ≤ 100)

Output

Three different integers (a, b and c) such that a n + b n = c n, 1 ≤ a, b, c ≤ 100. If there are several solutions you should output the one where a is minimal. If there are several solutions with the minimal a you should output the one with minimal b, and so on. Output −1 if there is no solution.

Example

input

output

0

-1

1

1 2 3

以前一直吐槽费马大定理实在是废,结果今天终于碰着了hhhhh。

这个定理贼简单,大致就是对于n>=3,不存在整数a,b,c使得a^n+b^n=c^n。

然后这就是个水题了hhhhh

(我直接在提交界面写的代码都没编译hhhhh)

#include
#include
#include
#include
using namespace std;
int n;
int main(){
scanf("%d",&n);
if(!n||n>) puts("-1");
else{
if(n==) puts("1 2 3");
else puts("3 4 5");
}
return ;
}