2-09. 装箱问题模拟(20)
来源:互联网 发布:梁家辉 座山雕 知乎 编辑:程序博客网 时间:2024/05/16 09:54
#include <cstring>#include<iostream>using namespace std;#define Size 1000int main(){ int box[Size+1]; int pos[Size+1]; memset( pos, 0, sizeof(pos) ); memset( box, 0, sizeof(box) ); int N; cin>>N; int sth[Size+1]; int i, j, ans=0; for( i=0; i<N; i++ ) { cin>>sth[i]; for( j=1; (100-box[j])<sth[i]; j++ ); if( j>ans ) ans=j; box[j]+=sth[i]; pos[i]=j; } for( int i=0; i<N; i++ ) { cout<<sth[i]<<" "<<pos[i]<<endl; } cout<<ans<<endl; return 0;}
0 0
- 2-09. 装箱问题模拟(20)
- 2-09. 装箱问题模拟(20)
- 2-09. 装箱问题模拟(20)
- 2-09. 装箱问题模拟(20)
- 2-09. 装箱问题模拟(20)
- 2-09. 装箱问题模拟(20) (ZJU_PAT 模拟)
- 浙大PAT 2-09. 装箱问题模拟 (解题思路)
- PAT 1015. 装箱问题模拟(20)
- PAT 2-09 装箱问题模拟(C语言实现)
- PAT 数据结构 2-09 装箱问题模拟
- 浙江大学PAT上机题解析之2-09. 装箱问题模拟
- 《数据结构学习与实验指导》2-9:装箱问题模拟
- codevs 1464 装箱问题2 模拟 解题报告
- 7-50 装箱问题(20 分)
- 【codevs1464】装箱问题2
- 1464 装箱问题 2
- 装箱问题(递归)
- 装箱问题(NP问题)
- Jensen-Shannon散度
- perl split 函数
- Swift-ReactiveCocoa3.0(一)Signal
- Android开发:带动画的分享效果
- 划线 UIGraphicsBeginImageContext
- 2-09. 装箱问题模拟(20)
- Android之Dialog对话框(一)
- android listview滑动过程中不加载图片,停止时加载图片。
- A10/A20 Bootloader加载过程分析 和cubieboard2SD卡镜像(一)
- Swift与Cocoa框架开发
- 用Jfinal开发的一个网站
- 合并两个排好序的链表
- HDU Stars
- window和document的含义