CodeForces-1061B Views Matter】的更多相关文章

传送门 https://www.cnblogs.com/violet-acmer/p/10005351.html 这是一道贪心题么???? 题意: 某展览馆展览一个物品,此物品有n堆,第 i 堆有a[ i ]个正方块,问最多可以去除多少个正方块,使得其俯视图与右视图的保持不变. 并且去除某正方块a下方的正方块时,是不会导致a方块下降的(无重力). 题解: 相关变量解释: int n,m; ll sum;//所有的方块 int a[maxn];//a[i] : 第i堆有a[i]个正方块 int i…
链接 [http://codeforces.com/contest/1061/problem/B] 题意 问你最多去掉多少块使得从上和右看,投影图不变 分析 注意细节,尤其第一列 代码 #include<bits/stdc++.h> using namespace std; #define ll long long ll a[100010]; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); //freopen(…
题目链接 https://vjudge.net/problem/CodeForces-1061B 题面 Description You came to the exhibition and one exhibit has drawn your attention. It consists of nn stacks of blocks, where the ii-th stack consists of aiai blocks resting on the surface. The height…
Description 给定一个只有一行的,由 \(n\) 组小正方体组成的方块,每组是由 \(a_i\) 块小正方体竖直堆叠起来的,求最多能抽掉多少块使得它的左视图和俯视图不变.方块不会掉落 Input 第一行是两个整数 \(n~,~m\),代表方块组数和另一个没什么卵用的参数. 下面一行 \(n\) 个数字,代表 \(a_i\) Output 一行一个数字代表答案 Hint \(1~\leq~n~\leq~10^5,1~\leq~a_i~\leq~10^9\) Solution 考虑因为只有…
思路: 贪心. 实现: #include <bits/stdc++.h> using namespace std; ]; int main() { int n, m; while (cin >> n >> m) { ; i <= n; i++) cin >> a[i]; sort(a + , a + n + ); ; ], cnt = a[] - ; ; i <= n; i++) { ]) { if (cnt) { ans += a[i]; cn…
Codeforces Round #523 (Div. 2) 题目一览表 来源 考察知识点 完成时间 A Coins cf 贪心(签到题) 2018.11.23 B Views Matter cf 思维??? 2018.11.24 C Multiplicity cf dp 2018.11.27 D TV Shows cf 贪心+multiset 2018.12.2…
A. Coins Water. #include <bits/stdc++.h> using namespace std; int n, s; int main() { while (scanf("%d%d", &n, &s) != EOF) { ; ; --i) while (s >= i) { ++res; s -= i; } printf("%d\n", res); } ; } B. Views Matter Solved.…
题目 Source http://codeforces.com/problemset/problem/528/D Description Leonid works for a small and promising start-up that works on decoding the human genome. His duties include solving complex problems of finding certain patterns in long strings cons…
B. Gerald is into Art Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/560/B Description Gerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought…
DZY Loves Chemistry Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 445B Description DZY loves chemistry, and he enjoys mixing chemicals. DZY has n chemicals, and m pairs of them will re…