B. One Bomb (#363 Div.2)】的更多相关文章

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 ("…
Codeforces Round 363 Div. 1 题目链接:## 点击打开链接 A. Vacations (1s, 256MB) 题目大意:给定连续 \(n\) 天,每天为如下四种状态之一: 不能进行运动或比赛 可以进行运动但不能比赛 可以进行比赛但不能运动 可以进行比赛或运动 对于每天,可以根据当天的状态选择运动,比赛或休息.但不能连续两天的选择均为运动或均为比赛.求在这 \(n\) 天中最少需要休息多少天. 数据范围:\(n \leq 100\) 简要题解:令 \(f_{i,0},f_…
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 时, 表明炸…
好久没做手生了,不然前四道都是能A的,当然,正常发挥也是菜. A:Launch of Collider 题意:20万个点排在一条直线上,其坐标均为偶数.从某一时刻开始向左或向右运动,速度为每秒1个单位长度.输入给出每个点的坐标及其移动的方向,求发生第一次碰撞的时间,若不会碰撞,则输出-1 最先发生碰撞的是一定是初始时相邻的两个点,因此只需对每个点循环一边,判断其是否会与下一个点碰撞,并求出其时间即可. #include<stdio.h> #include<stdlib.h> int…
A. Launch of Collider time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n parti…
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 occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (x…
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 occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (x…