FZU 2283 Tic-Tac-Toe (模拟)
来源:互联网 发布:淘宝优惠卷群怎么做 编辑:程序博客网 时间:2024/05/16 04:55
http://acm.fzu.edu.cn/problem.php?pid=2283
解题思路:
因为需要判断后两步是否能获胜,考虑到对方会走一步(堵住一个方向),那么现在存在的局面双方各执有的棋子数就一定大于等于两颗的。接着你需要两个步获胜,正中间的位置就不能让对方霸占。
#include<iostream>using namespace std;char s[4][4];int main(){ int t; cin>>t; while(t--) { char c; int cnt=0,ans; for(int i=0;i<3;i++) for(int j=0;j<3;j++) { cin>>s[i][j]; if(s[i][j]=='.') cnt++; } cin>>c; if(cnt<=5) { if(s[1][1]==c||s[1][1]=='.') ans=1; else ans=0; } else ans=0; if(ans) cout<<"Kim win!"<<endl; else cout<<"Cannot win!"<<endl; } return 0;}
阅读全文
0 0
- FZU 2283 Tic-Tac-Toe (模拟)
- FZU --- 2283 Tic-Tac-Toe 【三子棋小模拟】
- FZU Tic-Tac-Toe
- Tic-Tac-Toe FZU
- C. Tic-tac-toe【模拟】
- (fzu) Problem L Tic-Tac-Toe(水)
- checkio (tic-tac-toe)
- codeforces - 3C - Tic-tac-toe(模拟)
- CodeForces 3C Tic-tac-toe(模拟)
- POJ 2361 Tic Tac Toe 模拟
- cf 3C Tic-tac-toe(模拟)
- poj 3075 Tic-Tac-Toe 五子棋模拟
- poj 2361 Tic Tac Toe 五子棋模拟
- 【FZUoj 2283 Tic-Tac-Toe】& dfs & 博弈
- Tic-Tac-Toe
- [cf]Tic-tac-toe
- C - Tic-tac-toe
- Minimax-Tic Tac Toe
- SSD/DSOD check failed :mean_values_.size() == 1 || mean_values_.size() == img_channels Specify eithe
- Cannot call sendRedirect() after the response has been committed
- readyState的五种状态详解
- vue项目中使用ueditor
- QTreeWidget隐藏去掉或更改item项前的展开折叠三角图标
- FZU 2283 Tic-Tac-Toe (模拟)
- 如何使用日历插件datepicker
- 万用表通断档的学习
- EL表达式处理页面毫秒数
- C#接口学习之IEnumerable接口及其泛型版本(一)
- phpcms 新建模块并安装
- 学习android的一些好用的网站
- js深拷贝浅拷贝
- Android调试真机 offline问题