HDU 3368 Reversi
来源:互联网 发布:mysql存放路径 编辑:程序博客网 时间:2024/06/15 13:52
简单的搜索。详见代码。
#include<stdio.h>#include<iostream>#include<math.h>#include<string.h>#include<iomanip>#include<stdlib.h>#include<ctype.h>#include<algorithm>#include<deque>#include<functional>#include<iterator>#include<vector>#include<list>#include<map>#include<queue>#include<set>#include<stack>#define CPY(A, B) memcpy(A, B, sizeof(A))typedef long long LL;typedef unsigned long long uLL;const int MOD = 1e9 + 7;const int INF = 0x3f3f3f3f;const LL INFF = 0x3f3f3f3f3f3f3f3fLL;const double EPS = 1e-9;const double OO = 1e20;const double PI = acos (-1.0);int dx[]= {0,1,1,1,0,-1,-1,-1};int dy[]= {1,1,0,-1,-1,-1,0,1};using namespace std;char S[10][10];int SS (int a,int b) { int xx,yy,sum=0; for (int i=0; i<8; ++i) {//8个方向 xx=a+dx[i]; yy=b+dy[i]; int cnt=0; while (S[xx][yy]=='L') { cnt++;//one more,统计该方向数量 xx+=dx[i]; yy+=dy[i]; } if (S[xx][yy]=='D') {sum+=cnt;} } return sum;}int main() { int T; cin>>T; for (int cas=0; cas<T; cas++) { for (int i=0; i<8; ++i) { scanf ("%s",S[i]);/*输入一直没处理好,所以直接用%s输入解决问题*/ } int ans=0,t=0; for (int i=0; i<8; ++i) { for (int j=0; j<8; ++j) { if (S[i][j]=='*')/*!*/ { t= (SS (i,j) ); ans=max (ans,t);//find the largest one } } } printf ("Case %d: %d\n",cas+1,ans); } return 0;}
0 0
- HDU 3368 Reversi
- hdu 3368 Reversi
- HDU 3368 Reversi
- HDU 3368 Reversi
- HDU 3368——Reversi
- HDU:3368-Reversi(暴力枚举)
- HDU 3368 Reversi (简单dfs)
- Hdu 3368 Reversi(暴力)
- Reversi
- hdu3368 Reversi
- HDU3368 Reversi
- HDU3368-Reversi
- 606第三周周六赛 D - Reversi
- 利用Visual C#实现Reversi游戏开发(1)
- 利用Visual C#实现Reversi游戏开发(2)
- reversi-cli - 跟风做的一个黑白棋小游戏
- hdu 3368
- HDU 3368(翻转棋)
- No entity found for query
- 【CodeForces】448D - Multiplication Table(二分)
- hdu1113-字符查找问题 map容器
- [Leetcode]138. Copy List with Random Pointer
- 八皇后问题
- HDU 3368 Reversi
- 需要Device.dll 时,添加后显示 无法找到PInvoke DLL Device.dll
- React Native加载网络图片失败
- 页面加载完全后立即调用js
- 连续的找不到R文件,谨记一定要及时提交代码,不行就恢复
- linux下安装redis
- AngularJS 服务(Service)
- 纳雷科技周坤明:毫米波雷达的开发与应用技术
- Emmet缩写语法