【洛谷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
1 1
");
	else if (n==2) printf("4
1 1
2 1
2 2
1 2
");
	else printf("-1
");
	return 0;
}
原文地址:https://www.cnblogs.com/Dawn-Star/p/9815884.html