呵呵呵,这个题简直是一直在乱做,真是最近太弱了

 #include<bits/stdc++.h>
#define lowbit(x) x&(-x)
#define LL long long
#define N 200005
#define M 1000005
#define mod 2147483648LL
#define inf 0x7ffffffff
using namespace std;
inline int ra()
{
int x=,f=; char ch=getchar();
while (ch<'' || ch>''){if (ch=='-') f=-; ch=getchar();}
while (ch>='' && ch<=''){x=x*+ch-''; ch=getchar();}
return x*f;
}
int a[][];
bool can(int x, int y)
{
if (x< || x>) return ;
if (y< || y>) return ;
return ;
}
bool check(int x, int y)
{
int tot=a[x][y];
tot+=a[x-][y];
tot+=a[x+][y];
if (tot>=) return ; tot=a[x][y];
tot+=a[x][y-];
tot+=a[x][y+];
if (tot>=) return ; tot=a[x][y];
tot+=a[x-][y-];
tot+=a[x+][y+];
if (tot>=) return ; tot=a[x][y];
tot+=a[x-][y+];
tot+=a[x+][y-];
if (tot>=) return ;
return ;
}
int main()
{
for (int i=; i<=; i++)
for (int j=; j<=; j++)
a[i][j]=-;
for (int i=; i<=; i++)
{
string ch; cin>>ch;
for (int j=; j<=; j++)
{
if (ch[j-]=='x') a[i][j]=;
if (ch[j-]=='.') a[i][j]=;
}
}
for (int i=; i<=; i++)
for (int j=; j<=; j++)
{
if ((a[i][j]== || a[i][j]==) && check(i,j))
{
cout<<"YES";
return ;
}
}
cout<<"NO";
return ;
}

cf754 B. Ilya and tic-tac-toe game的更多相关文章

  1. Principle of Computing (Python)学习笔记(7) DFS Search + Tic Tac Toe use MiniMax Stratedy

    1. Trees Tree is a recursive structure. 1.1 math nodes https://class.coursera.org/principlescomputin ...

  2. POJ 2361 Tic Tac Toe

    题目:给定一个3*3的矩阵,是一个井字过三关游戏.开始为X先走,问你这个是不是一个合法的游戏.也就是,现在这种情况,能不能出现.如果有人赢了,那应该立即停止.那么可以知道X的步数和O的步数应该满足x= ...

  3. 【leetcode】1275. Find Winner on a Tic Tac Toe Game

    题目如下: Tic-tac-toe is played by two players A and B on a 3 x 3 grid. Here are the rules of Tic-Tac-To ...

  4. 2019 GDUT Rating Contest III : Problem C. Team Tic Tac Toe

    题面: C. Team Tic Tac Toe Input file: standard input Output file: standard output Time limit: 1 second M ...

  5. [CareerCup] 17.2 Tic Tac Toe 井字棋游戏

    17.2 Design an algorithm to figure out if someone has won a game oftic-tac-toe. 这道题让我们判断玩家是否能赢井字棋游戏, ...

  6. Epic - Tic Tac Toe

    N*N matrix is given with input red or black.You can move horizontally, vertically or diagonally. If ...

  7. python 井字棋(Tic Tac Toe)

    说明 用python实现了井字棋,整个框架是本人自己构思的,自认为比较满意.另外,90%+的代码也是本人逐字逐句敲的. minimax算法还没完全理解,所以参考了这里的代码,并作了修改. 特点 可以选 ...

  8. ACM-Team Tic Tac Toe

    我的代码: #include <bits/stdc++.h> using namespace std; int main() { char a[3][3]; int i,j=0; for( ...

  9. LeetCode 5275. 找出井字棋的获胜者 Find Winner on a Tic Tac Toe Game

    地址 https://www.acwing.com/solution/LeetCode/content/6670/ 题目描述A 和 B 在一个 3 x 3 的网格上玩井字棋. 井字棋游戏的规则如下: ...

随机推荐

  1. MySQL表类型

    学习Mysql数据库,Mysql表类型都有哪些是一定需要知道的,下面就为您介绍七种Mysql表类型,希望能对您学习Mysql表类型有所帮助. MySQL作为当前最为流行的免费数据库服务引擎,已经风靡了 ...

  2. Search in Rotated Sorted Array II

    Question: Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed? W ...

  3. 剑指offer-第三章高质量的代码(调整数组顺序使得奇数位于偶数的前面)

    题目:输入一个整数数组,实现一个函数中调整该数组中数字的顺序,使得所有的奇数位于数组的前半部,所有偶数位于数组的后半部. 思路:用两个指针p1和p2,分别指向数组的头和尾部,p1只向后移,p2只向前移 ...

  4. 深入了解 Oracle Flex ASM 及其优点

    简介 Oracle Real Application Cluster (RAC) 是 Oracle 解决方案中的一个著名产品,用于保持业务数据的高可用性.Oracle RAC 允许在所有集群节点之间共 ...

  5. 【转】Xcode中的iOS模拟器(iOS Simulator)的介绍和使用心得

    iOS模拟器简介 iOS功能简介 iOS模拟器,是在Mac下面开发程序时,开发iOS平台的程序时候,可以使用的辅助工具. 其功能是,帮你模拟iOS平台设备,在模拟器上运行对应的程序,以方便你没有实体设 ...

  6. 502 Bad Gateway nginx 解决

    打开 /usr/local/php/etc/php-fpm.conf 调大以下两个参数(根据服务器实际情况,过大也不行) <value name=”max_children”>5120&l ...

  7. [Everyday Mathematics]20150301

    设 $f(x)$ 在 $[-1,1]$ 上有任意阶导数, $f^{(n)}(0)=0$, 其中 $n$ 是任意正整数, 且存在 $C>0$, $$\bex |f^{(n)}(x)|\leq C^ ...

  8. MYSQL性能查看(命中率,慢查询)

    网上有很多的文章教怎么配置MySQL服务器,但考虑到服务器硬件配置的不同,具体应用的差别,那些文章的做法只能作为初步设置参考,我们需要根据自己的情况进行配置优化,好的做法是MySQL服务器稳定运行了一 ...

  9. HTTP长连接(Comet)实现方式示例

    昨天看了comet的介绍后,虽然大概知道了comet的原理,不过没实际用过还是不太清楚,于是今天又在网上翻了一下别的网友共享的comet实现http长连接的例子,在 Comet Server Push ...

  10. Window.onLoad 和 DOMContentLoaded事件的先后顺序

    相信写js的,都知道window.onload吧,但是并不是每个人都知道DOMContentLoaded,其实即使你不知道,很有可能你也经常使用了这个东西. 一般情况下,DOMContentLoade ...