【洛谷P2041 分裂游戏】数学+瞎蒙

分析

我们推不出n=3的图,开始猜测,答案在n>2时无解。(<-正解)

AC代码

#include <bits/stdc++.h>
using namespace std;
inline int read() {
	int w=0,x=0;char ch=0;
	while (!isdigit(ch)) {w|=ch=='-';ch=getchar();}
	while (isdigit(ch)) {x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return w?-x:x;
}
int main() {
	std::ios::sync_with_stdio(false);
	int n=read();
	if (n==1) printf("1\n1 1\n");
	else if (n==2) printf("4\n1 1\n2 1\n2 2\n1 2\n");
	else printf("-1\n");
	return 0;
}
posted @ 2018-10-19 13:12  dawnstar  阅读(298)  评论(0)    收藏  举报