标签:ref queue osi define number lag rip msu intersect
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)
Total Submission(s): 1732 Accepted Submission(s): 552
#include <iostream> #include <cstring> #include <cstdio> #include <algorithm> #include <queue> #include <vector> #include <iomanip> #include <math.h> #include <map> using namespace std; #define FIN freopen("input.txt","r",stdin); #define FOUT freopen("output.txt","w",stdout); #define INF 0x3f3f3f3f #define INFLL 0x3f3f3f3f3f3f3f #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 typedef long long LL; typedef pair<int, int> PII; char chess[15][15]; int vis[15][15]; int flag, num; //xo bool check(int x, int y) { return x >= 0 && x <= 8 && y >= 0 && y <= 8 && chess[x][y] != ‘x‘ && vis[x][y] == 0; } void llss(int x, int y) { if(num >= 2) return ; if(check(x, y)) { vis[x][y] = 1; if(chess[x][y] == ‘o‘) { llss(x + 1, y); llss(x - 1, y); llss(x, y + 1); llss(x, y - 1); } else { num++; } } else return ; } int main() { //FIN int T; int cas = 1; scanf("%d", &T); while(T--) { flag = 0; for(int i = 0; i < 9; i++) scanf("%s", chess[i]); for(int i = 0; i < 9; i++) { for(int j = 0; j < 9; j++) { memset(vis, 0, sizeof(vis)); num = 0; if(chess[i][j] == ‘o‘ && flag == 0) llss(i, j); if(num == 1) { flag = 1; break; } } } if(flag) printf("Case #%d: Can kill in one move!!!\n", cas++); else printf("Case #%d: Can not kill in one move!!!\n", cas++); } }
标签:ref queue osi define number lag rip msu intersect
原文地址:http://www.cnblogs.com/Hyouka/p/6041290.html