codeforces 903C. Boxes Packing
来源:互联网 发布:金税盘安装软件下载 编辑:程序博客网 时间:2024/04/19 06:59
题意:现在有N个立方体盒子,你现在可以把这些盒子套起来(一个盒子的尺寸严格小于另一个盒子),问最少能看到多少个盒子?
思路:模拟。排个序依次往没用过的最大的盒子里面放就行。
#include<bits/stdc++.h>using namespace std;const int MAXN = 5e3 + 5;int n, a[MAXN];bool vis[MAXN];int main(){while(~scanf("%d",&n)){memset(vis,0,sizeof(vis));for(int i = 0; i < n; i++) scanf("%d",&a[i]);sort(a, a + n);int ans = 0;for(int i = n - 1; i >= 0; i--){if(vis[i] == true) continue;ans++;int now = a[i];for(int j = i - 1; j >= 0; j--){if(vis[j] == true) continue;if(a[j] < now){now = a[j]; vis[j] = true;}}}printf("%d\n",ans);}return 0;}
阅读全文
0 0
- codeforces 903C. Boxes Packing
- Codeforces 270c Magical Boxes
- Codeforces #165 div2 C. Magical Boxes
- CodeForces 390C Inna and Candy Boxes
- codeforces 390c Inna and Candy Boxes
- codeforces 551 C GukiZ hates Boxes
- codeforces 390C Inna and Candy Boxes
- 【24.67%】【codeforces 551C】 GukiZ hates Boxes
- Codeforces 821 C. Okabe and Boxes
- Codeforces 821C-Okabe and Boxes
- Codeforces 821C Okabe and Boxes 题解
- codeforces 420 div2 C Okabe and Boxes
- Codeforces#420 C. Okabe and Boxes
- 【Codeforces 821C. Okabe and Boxes】
- Codeforces Round #420 C. Okabe and Boxes
- codeforces 420-C. Okabe and Boxes
- codeforces-551C GukiZ hates Boxes
- Codeforces Round #229 (Div. 2) C. Inna and Candy Boxes
- java6
- OpenCV-Python learning---4
- python编程练习---递归输出杨辉三角
- RecyclerView多条目
- Android 之 LayoutParams
- codeforces 903C. Boxes Packing
- sublime text3 常用个人设置
- 【最大化最小值】POJ
- javascript学习笔记day1
- caffe简要介绍
- Retrofit2打印 网络请求日志
- 图片模式切换的代码
- RecyclerView 不一样的列表
- java7