[pyoj-MD2017 A]三巨头的加法

竟然还有丧心病狂的题考费马大定理。。。

费马大定理:

当整数 $n>2$ 时,关于 $x, y, z$ 的方程 $x^n + y^n = z^n$ 没有正整数解。

当 $n=1$ 的时候,显然 $x=1,y=2,z=3$ 是符合题意的。。

当 $n=2$ 的时候,打个表就能发现答案是勾三股四弦五。。。

当 $n>2$ 的时候,输出"No Solution."就行。。。

 1 #include <iostream>
 2 #include <algorithm>
 3 #include <cstdio>
 4 #include <cstring>
 5 #include <cstdlib>
 6 #include <string>
 7 #include <vector>
 8 #include <cmath>
 9 #include <queue>
10 #include <complex>
11 using namespace std;
12 
13 long long n;
14 
15 int main(){
16     scanf("%lld",&n);
17     if(n==1)puts("1 2 3");
18     else if(n==2)puts("3 4 5");
19     else puts("No solution.");
20 }
View Code

posted @ 2017-02-09 13:52  KingSann  阅读(215)  评论(0编辑  收藏  举报