CodeForces - 699B One Bomb】的更多相关文章

题目地址:http://codeforces.com/contest/699/problem/B 题目大意: 一个矩阵,内容由‘.’和‘*’组成(‘.’ 空,‘*’ 代表墙),墙分布在不同位置,现找出一个位置放置 炸弹,炸弹能炸当前位置的一整行和一整列,如果炸弹的位置可以将所有的墙都炸掉,则输出 “YES” 并输出该位置,如果不存在这样一个位置,这输出“NO”.[炸弹可以放在空地或者墙上] 解题思路: 1. 对每行每列的墙进行统计,如果该位置为墙,则该行的墙数++同时该列的墙++,统计出所有墙的…
题目链接: http://codeforces.com/problemset/problem/699/B 题目大意: N*M的图,*代表墙.代表空地.问能否在任意位置(可以是墙上)放一枚炸弹(能炸所在行和列),把所有的墙都炸掉.输出答案(不唯一). 题目思路: [模拟] N2预处理出每一行能炸多少墙,每一列能炸多少墙.再N2枚举放炸弹的位置看能炸掉的墙数目是否等于总数.注意如果炸弹位置上有墙要-1. // //by coolxxx ////<bits/stdc++.h> #include<…
r[i],c[i]分别表示第i行有几个*,第i列有几个*. 枚举每个位置如果c[i]+r[j]-(本身是不是*)==总*数,则该位置即为答案. #include<cstdio> #include<cstring> #include<algorithm> #define N 10050 using namespace std; int n,m,r[N],c[N],x,y,num; char ma[N][N]; int main(){ scanf("%d%d&qu…
B. One Bomb time limit per test1 second memory limit per test256 megabytes Problem Description You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupi…
B - B CodeForces - 699B 题目: You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay the bom…
E. Clockwork Bomb 题目连接: http://www.codeforces.com/contest/650/problem/E Description My name is James diGriz, I'm the most clever robber and treasure hunter in the whole galaxy. There are books written about my adventures and songs about my operations…
One Bomb 题意: 只有一个炸弹,并且一个只能炸一行和一列的'*',问最后能否炸完所以'*',如果可以输出炸弹坐标 题解: 这题做的时候真的没什么好想法,明知道b题应该不难,但只会瞎写,最后越写越乱,我就放弃了.看了题解,果然还是我不行... 首先枚举一遍,记录总'*'数,和每行,每列的'*'数,之后再枚举一遍,看是否一行一列的'*'数和总'*'数相等,如果是,那就是答案,如果没有,就是NO. 代码: #include <bits/stdc++.h> using namespace st…
B. One Bomb time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".&…
B. One Bomb time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".&…
题目链接:http://codeforces.com/contest/699/problem/B 题解: 首先统计每行每列出现'*'的次数,以及'*'出现的总次数,得到r[n]和c[m]数组,以及sum,.然后再枚举每一个格子(O(n^2)枚举,反正输入都是枚举的). 对于每一个格子s[i][j]: 1.如果它是'*', 那么当 r[i] + c[j] - 1 = sum 时, 表明炸弹放在这个位置可以炸掉所有的墙. 2.如果它是'.', 那么当 r[i] + c[j] = sum 时, 表明炸…