HDU 4770】的更多相关文章

pid=4770" target="_blank" style="">题目链接:hdu 4770 Lights Against Dudely 题目大意:在一个N*M的银行里.有N*M个房间,'#'代表牢固的房间,'.'代表的是脆弱的房间.脆弱的房间个数不会超过15个,如今为了确保安全,要在若干个脆弱的房间上装灯.普通的灯是照亮{0, 0}, {-1, 0}, {0, 1}(和题目中坐标有点出入).然后能够装一个特殊的,能够照耀 { {0, 0}, {…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4770 思路:由于最多只有15个".",可以直接枚举放置的位置,然后判断是否能够全部点亮即可.需要注意的是,有一个特殊的light,也需要枚举它的位置以及放置的方向. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using names…
又一发吐血ac,,,再次明白了用函数(代码重用)和思路清晰的重要性. 11779687 2014-10-02 20:57:53 Accepted 4770 0MS 496K 2976 B G++ czy Lights Against Dudely Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1360    Accepted Subm…
Lights Against Dudely Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 525    Accepted Submission(s): 157 Problem Description Harry: "But Hagrid. How am I going to pay for all of this? I haven't…
Lights Against Dudely Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description Harry: "But Hagrid. How am I going to pay for all of this? I haven't any money." Hagrid: "Well there's your money,…
思路: 这个题完全就是暴力的,就是代码长了一点. 用到了状压,因为之前不知道状压是个东西,大佬们天天说,可是我又没学过,所以对状压有一点阴影,不过这题中的状压还是蛮简单的. 枚举所有情况,取开灯数最少的. 解释都在注释之中了. #include<iostream> #include<algorithm> #include<vector> #include<stack> #include<queue> #include<map> #in…
Lights Against Dudely Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 171    Accepted Submission(s): 53 Problem Description Harry: "But Hagrid. How am I going to pay for all of this? I haven't a…
这题说的是一在一个N*M的房间内,然后有些房间不能被灯光照亮,有一个灯可以转动方向,其他的灯只能在固定一个方向上,因为数据比较小,所以比较水,直接暴力的进行枚举就好了,但是还是 wa了很久,原因没认真读题,然后就是小细节的错误,在标记的时候背后面的,点给覆盖了,(考虑不周全). #include <iostream> #include<string.h> #include<cstdio> using namespace std; const int MAXX=10000…
Description Harry: "But Hagrid. How am I going to pay for all of this? I haven't any money." Hagrid: "Well there's your money, Harry! Gringotts, the wizard bank! Ain't no safer place. Not one. Except perhaps Hogwarts." ― Rubeus Hagrid…
/* 长记性了,以后对大数组初始化要注意了!140ms 原来是对vis数组进行每次初始化,每次初始化要200*200的复杂度 一直超时,发现没必要这样,直接标记点就行了,只需要一个15的数组用来标记,vis数组用来映射坐标就行了 然后就是暴力加了一点优化,下面没有加优化. */ #include<stdio.h> #include<string.h> #define inf 0x3fffffff #define N 210 int vis[N][N]; char s[N][N];…