hdu1045】的更多相关文章

#include<stdio.h> #include<string.h> int n; int maxx; ][]; ]={,-,,}; ]={,,,-}; ][][];//炮台位置 bool ok(int x,int y){ int i,x1,y1; if(map[x][y]!='.') return false; ;i<;i++){ x1=x+dx[i]; y1=y+dy[i]; ){ ||x1>=n||y1<||y1>=n||map[x1][y1]==…
在一张地图上建立碉堡(X),要求每行没列不能放两个,除非中间有强挡着.求最多能放多少个碉堡 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #define N 5 using namespace std; int n,ans; char maps[N][N]; int judge(int x,int y) { int i; if(maps[x][y]=='X'…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1045 Fire Net Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 8185    Accepted Submission(s): 4691 Problem Description Suppose that we have a squa…
http://acm.hdu.edu.cn/showproblem.php?pid=1045 Fire Net Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6756    Accepted Submission(s): 3829 Problem Description Suppose that we have a square ci…
#include<iostream> using namespace std; int count = 0, n = 0; //判断该ch[x][y]是否可以放置 bool isOk(char **ch, int x, int y){ int i; //向上检索 for (i = x - 1; i >=0; --i){ if(ch[i][y]=='0'){ return false; } //碰到墙 if(ch[i][y] == 'X'){ break; } } //向左检索 for (…
#include<iostream> #include<cstdio> #include<queue> #include<vector> #include<map> #include<list> #include<set> #include<stack> #include<cstring> #include<string> #include<algorithm> #inclu…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1045 题目大意: 给你一幅n*n的图,再给你一些点,这些点的上下左右不能再放其他点,除非有墙('X')隔着,问最多可以放多少个这样的点. 思路: 由于n不大于4,最多16个点,想到可以二进制枚举子集,然后逐个判断每个子集的可行性. #include<iostream> #include<string> #include<vector> #include<cstdio&…
Fire Net Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12575    Accepted Submission(s): 7614 Problem Description Suppose that we have a square city with straight streets. A map of a city is a…
Fire Net Problem Description Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall. A blockhouse is a small castle that has four openings t…
Fire Net Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15653    Accepted Submission(s): 9474 题目链接:acm.hdu.edu.cn/showproblem.php?pid=1045 Description: Suppose that we have a square city with s…