UOJ282 长度测量鸡

本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作。

本文作者:ljh2000 
作者博客:http://www.cnblogs.com/ljh2000-jump/
转载请注明出处,侵权必究,保留最终解释权!

题目链接:http://uoj.ac/problem/282

正解:数学+结论

解题报告:

  写个搜索就会发现题目有解,当且仅当n<=3,然后就没有然后了...

  科学证明:http://vfleaking.blog.uoj.ac/blog/2292

  

  

//It is made by ljh2000
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <complex>
using namespace std;
typedef long long LL;
int n;
inline int getint(){
    int w=0,q=0; char c=getchar(); while((c<'0'||c>'9') && c!='-') c=getchar();
    if(c=='-') q=1,c=getchar(); while (c>='0'&&c<='9') w=w*10+c-'0',c=getchar(); return q?-w:w;
}

inline void work(){
	int T=getint();
	while(T--) {
		n=getint();
		if(n<=3) printf("1
");
		else printf("-1
");
	}
}

int main()
{
    work();
    return 0;
}

  

原文地址:https://www.cnblogs.com/ljh2000-jump/p/6357339.html