POJ1068
来源:互联网 发布:淘宝订单怎么拆分发货 编辑:程序博客网 时间:2024/05/01 09:04
摘要:普通模拟题
#include <iostream>
#include <string.h>
using namespace std;
const int size = 100;
int s[size+1]= {0};
int f[size+1] = {0};
int main()
{
int n;
cin >> n;
for(int index=1; index<=n; index++){
memset(s, 0, sizeof(s));
memset(f, 0, sizeof(f));
int m;
cin >> m;
int pre_num, current_num;
pre_num = 0;
for(int i=1; i<=m; i++){
int current_pos = pre_num + i-1;
cin >> current_num;
int j = 1;
for(; j<=current_num-pre_num; j++){
s[current_pos+j] = 0;
}
s[current_pos+j] = 1;
pre_num = current_num;
}
for(int j=1; j<=size; j++){
if( s[j] == 0 ){
continue;
}
int k=j-1;
for(; k>=1; k--){
if(s[k] == 0 && f[k] == 0){
f[k] = 1;
break;
}
}
int r_c = 0;
for(int o=k+1; o<=j; o++){
if(s[o] == 1){
r_c++;
}
}
cout << r_c << " ";
}
cout << endl;
}
return 0;
}
- POJ1068
- POJ1068
- Poj1068
- poj1068
- poj1068
- poj1068
- poj1068
- poj1068
- poj1068
- poj1068
- POJ1068
- poj1068
- poj1068
- poj1068
- POJ1068
- poj1068
- poj1068
- poj1068
- DirectFB资料(1)
- vc2005 使用Boost库的编译步骤.
- 贪心的想你
- Picoblaze的简易中断实验的启示
- POJ 1007
- POJ1068
- SAP message 探究
- 经典技术类图书收藏
- 面试常见的为题(看看你能答出来几道?)
- 有关PHP中的大小写区分
- 利用InstallShield12制作安装包之二:利用InstallScript脚本进行最基本的编程
- C#中获取文件夹的名称
- flex学习笔记2---如何创建Flex应用程序
- Oracle Shrink Table