NYOJ 1163 cakes(自己想复杂了)
来源:互联网 发布:传承网络 编辑:程序博客网 时间:2024/06/05 00:58
cakes
时间限制:1000 ms | 内存限制:65535 KB
难度:0
- 描述
- there are some naughty little cakes(less than 1000), each cake has a numberthey stand in plates whose number start from 0 increasing in turn . The process of waiting for being taste by small Q is very boring so they made a game .According to the serial numbers of the cake from small to large lying on a plate ,but they forgot the plates that they lying before, if they don't go back, small Q will be very angry.So, smart programmer monkey can you help them?
- 输入
- Multiple sets of test data
first give you a digsit the number of cakes;
then there are n digsits - 输出
- 。。。
- 样例输入
44 2 1 354 3 1 2 5
- 样例输出
2 1 3 02 3 1 0 4
- 提示
- maybe they are equal to others,if so ,printf the order before
- 来源
- 原创
- 上传者
- TC_张焰
这道题自己有想复杂了,其实写个结构体,在里面定义两个变量,存进去,排序就可以了,wa了那么多次T-T
<pre name="code" class="cpp">#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;struct node{ int x; int y;}a[1050];int cmp(node e,node r){ if(e.x==r.x) return e.y<r.y;//这里就是提示那句话 return e.x<r.x;}int main(){ int n; while(~scanf("%d",&n)) { for(int i=0;i<n;i++) { scanf("%d",&a[i].x); a[i].y=i; } sort(a,a+n,cmp); for(int i=0;i<n;i++) { printf("%d ",a[i].y); } printf("\n"); }}
0 0
- NYOJ 1163 cakes(自己想复杂了)
- nyoj cakes 1163 (排序) 水
- codeforces #340B(简单计算几何 自己想复杂了)
- cakes
- ssoj2663 two cakes(动归)
- 关于用户密码的简单加密(DES+MD5)与复杂加密(自己想的)
- HDU 4762 Cut the Cakes(数学题,推公式)
- ZOJ 3916 Buy Cakes (贪心+优先队列维护)
- HDU 5997 rausen loves cakes (启发式合并+树状数组)
- 找三元环(bzoj 3498: PA2009 Cakes)
- [bzoj3498]Cakes
- 自己做的糯米饭 没有网上说的那么复杂,试了三次
- NYOJ-250-ROOM ASSIGNATION(第三届河南省程序设计大赛(复杂线段树))
- NYOJ 1023 还是回文(思路复杂)
- 自己搞不清楚所以复杂
- 稍微复杂的分类器(加入了Normalization)
- 从网上搜了好多东西,感觉很复杂,不如自己重新再来.IIS中网站配置
- NYOJ-死神来了
- RAII惯用法:C++资源管理的利器
- 认证流程【2】-main_loop函数
- Hadoop学习笔记九之Java heap space(堆溢出)
- 第二周项目3—汉诺塔程序
- 认证流程【3】-http_callback_404函数
- NYOJ 1163 cakes(自己想复杂了)
- GIT上优秀的IOS框架
- 设置Activity的显示位置
- 认证流程【4】-http_callback_auth()函数
- 第二周项目2个人感受 别让大学对不起青春
- vm调整相关算法(草稿)
- JavaWeb工程师面试(一)
- 第2周项目3-体验复杂度(2)
- CLRS 10.2链表