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<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
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 ;
}

URAL 1349 Farm的更多相关文章

  1. SharePoint 2013: A feature with ID has already been installed in this farm

    使用Visual Studio 2013创建一个可视web 部件,当右击项目选择"部署"时报错: "Error occurred in deployment step ' ...

  2. How To Collect ULS Log from SharePoint Farm

    We can use below command to collect SharePoint ULS log from all servers in the Farm in PowerShell. M ...

  3. How To Restart timer service on all servers in farm

    [array]$servers= Get-SPServer | ? {$_.Role -eq "Application"} $farm = Get-SPFarm foreach ( ...

  4. ZOJ 2412 Farm Irrigation

    Farm Irrigation Time Limit: 2 Seconds      Memory Limit: 65536 KB Benny has a spacious farm land to ...

  5. nginx+iis、NLB、Web Farm、Web Garden、ARR

    nginx+iis实现负载均衡 在win2008R2上使用(NLB)网络负载均衡 NLB网路负载均衡管理器详解 [译文]Web Farm和Web Garden的区别? IIS负载均衡-Applicat ...

  6. 续并查集学习笔记——Closing the farm题解

    在很多时候,并查集并不是一个完整的解题方法,而是一种思路. 通过以下题目来体会并查集逆向运用的思想. Description Farmer John and his cows are planning ...

  7. SharePoint Error - The current user is not an SharePoint Server farm administrator

    错误截图 错误日志 位置:C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\LOGS 主要错误 The c ...

  8. hdu.1198.Farm Irrigation(dfs +放大建图)

    Farm Irrigation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  9. 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome

    题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...

随机推荐

  1. 使用adobe pdf去除PDF文档中的批量雷同文本

    一.问题的提出 MgoSoft tiff to pdf软件没有提供中国地区的非VISA用户的购买渠道,中国通常都是银联标识走天下,卡不是VISA买不了这样的软件, 那么, MgoSoft tiff t ...

  2. HDU 3446 有贪心思想的01背包

    Proud Merchants Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others) ...

  3. [hihocoder 1050]求树的最长链

    题目链接:http://hihocoder.com/problemset/problem/1050 两种方法: 1. 两遍dfs,第一次随便找一个根,找到距离这个根最远的点,这个点必然是最长链的一端. ...

  4. [poj 1947]树dp+背包问题

    题目链接:http://poj.org/problem?id=1947 看了很多题解都是直接一遍dfs就搞定的方法,但是我实在是没看懂那个转移方程.最后在茫茫博客中终于发现了一个有逻辑的方法,但是复杂 ...

  5. 《vue.js实战》练习---标签页组件

    html: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...

  6. netty入门代码学习

    服务端代码: package com.lsp.netty; /** * @author lishupeng * @create 2017-05-27 下午 3:48 **/ import io.net ...

  7. Lesson 2

    周末重新学习了一下java,有了些新的体会 1.关于jdk, jre,and  JVM: Jdk: java development kit,面向开发人员的java开发工具包 Jre:java run ...

  8. spring boot修改内置容器tomcat的服务端口

    方式一 在spring boot的web 工程中,可以使用内置的web container.有时需要修改服务端口,可以通过配置类和@Configuration注解来完成. // MyConfigura ...

  9. [bzoj2124]等差子序列——线段树+字符串哈希

    题目大意 给一个1到N的排列\(A_i\),询问是否存在\(p_i\),\(i>=3\),使得\(A_{p_1}, A_{p_2}, ... ,A_{p_len}\)是一个等差序列. 题解 显然 ...

  10. RtlInitUnicodeString

    代码1: WCHAR enumeratorName[] = {}; UNICODE_STRING unicodeEnumName; RtlInitUnicodeString(&unicodeE ...