题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3863
此题的棋盘很容易就能看出谁先手谁胜,因为注意到连接左右或上下,只要是先手别人就堵不住,而如果对方不去堵而直接去连接自己的,则到最后正好慢一步。综上先手必胜。
博弈的题目,如果先手赢则输出I bet on Oregon Maple~
所以代码简单到这样:
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
int N;
while(scanf("%d",&N)&&N!=-1){
printf("I bet on Oregon Maple~\n");
}
return 0;
}
呵呵,有兴趣的不妨看看,很有意思的一道题目。