题解 CF1359B 【New Theatre Square】】的更多相关文章

题目链接:B.New Theatre Square 题意: 你要把所有"." 都变成"*",你可以有两个选择,第一种就是一次铺一个方块(1*1),第二种就是同一行一次铺两个(1*2).第一种花费x,第二种花费y.问最少花费多少能把所有铺完 题解: 如果y>=2*x,那么就直接找到所有".",然后乘于x就行 否则就找俩俩一对就行了 代码: 1 #include<stdio.h> 2 #include<algorithm>…
A. Theatre Square time limit per test 2 seconds memory limit per test 64 megabytes input standard input output standard output Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the ci…
http://codeforces.com/problemset/problem/1/A Theatre Square time limit per test 2 seconds memory limit per test 64 megabytes input standard input output standard output Theatre Square in the capital city of Berland has a rectangular shape with the si…
Theatre Square time limit per test 2 seconds memory limit per test 64 megabytes input standard input output standard output Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city'…
A. Theatre Square Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is o…
A - Theatre Square Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 1A Description Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the…
A. Theatre Square time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the ci…
题意 有一个 n×m 的广场,其中一部分要铺地砖,地砖有两种, 1 × 1 和 1×2 的,后者只能横着铺,其中, 1 × 1的单价为 x , 1 × 2 的单价为 y , 输入这个广场,"."表示要铺地砖,求最少花费.注意,地砖不可重合,也不可覆盖在已铺地砖区域. 思路 这显然是贪心,分别计算全铺 $ 1 × 1$ 的方案价钱和尽量多铺 $ 1 × 2$ 的方案价钱,最后将最小的输出,因为只能横铺,方向固定,所以十分简单. 代码 具体细节见注释 #include<bits/st…
题目说明 Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. For example, given the following matrix: 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1 0 Return 4. 题目分析 我采用的方法比较笨拙,就是对于矩阵中的每一个元素,以反"L"…
题目链接:https://codeforces.com/contest/1359/problem/B 题意 有一块 $n \times m$ 的地板和两种瓷砖: $1 \times 1$,每块花费为 $x$ $1 \times 2$,每块花费为 $y$ 地板为 '.' 表示未铺瓷砖,瓷砖不可旋转, 问铺满瓷砖的最小花费. 题解 因为 $1 \times 2$ 的瓷砖不能旋转,所以每次逐行考虑即可,注意 $y$ 取 $min(2x, y)$ . 代码 #include <bits/stdc++.h…