POJ 2082Lost Cows<>
来源:互联网 发布:mac直接进入win10 编辑:程序博客网 时间:2024/06/04 20:49
题意:
给出一个序列a[1....n],a[i]代表在0....i-1中比a[i]小的个数。求出这个序列。
思路:
1:暴力。
#include<cstdio>#include<iostream>#include<cstring>#include<cstdlib>#include<algorithm>#include<cmath>#include<queue>#include<deque>#include<set>using namespace std;const int maxn=8000+10;int ans [maxn];int a[maxn];int vis[maxn];int N;int main (){ scanf("%d",&N); for(int i=2;i<=N;i++) scanf("%d",&a[i]); for(int i=N;i>=1;i--)//从最后往前遍历 { int t=0,j; for( j=1;j<=N;j++)//遍历1~ ~N; { if(!vis[j]) { t++; if(t==a[i]+1) break; } } ans[i]=j; vis[j]=1; } for(int i=1;i<=N;i++) printf("%d\n",ans[i]); return 0;}
0 0
- POJ 2082Lost Cows<>
- POJ 2182 :Lost Cows
- poj 2182 Lost Cows
- poj 2182 Lost Cows
- poj 2182 Lost Cows
- POJ 2182 Lost Cows
- POJ 2182 Lost Cows
- poj 2182 Lost Cows
- POJ 2182 Lost Cows
- POJ-2182-Lost Cows
- POJ--2182--Lost Cows
- poj 2182 Lost Cows
- poj 2182 Lost Cows
- Poj 2182 Lost Cows
- POJ 2182 Lost Cows
- POJ 2182 Lost Cows
- poj 2182 Lost Cows
- POJ 2182 Lost Cows
- poj3299 Humidex(water)
- Android Shape属性(内含一个Button完整的xml定义)
- Spark的Master分析1(主备切换机制原理分析)
- Android 创建抽屉导航
- JAVA对象数组的初始化
- POJ 2082Lost Cows<>
- 机器学习好总结
- HBase客户端API使用
- Bootstrap、hcharts、百度地图、jquery插件库
- Meteor Showerpoj3669
- 企业数据仓库中代理主键使用
- (static)静态代码块,非静态代码块和构造函数
- HDU 5750 Dertouzos
- 串口通信协议