cakes
来源:互联网 发布:js cookie 跨域 编辑:程序博客网 时间:2024/06/05 22:38
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
import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner scanner = new Scanner(System.in);while (scanner.hasNext()) {int number = scanner.nextInt();int arr[] = new int[number + 5];int vis[] = new int[number + 5];for (int i = 0; i < number; i++) {arr[i] = scanner.nextInt();vis[i] = i;}for (int i = 0; i < number - 1; i++) {for (int j = 0; j < number - 1 - i; j++) {if (arr[j] > arr[j + 1]) {int temp = arr[j];arr[j] = arr[j + 1];arr[j + 1] = temp;temp = vis[j];vis[j] = vis[j + 1];vis[j + 1] = temp;}}}for (int i = 0; i < number; i++) {System.out.print(vis[i] + " ");}System.out.println();}}}
阅读全文
0 0
- cakes
- [bzoj3498]Cakes
- tzc 3489 Baking Cakes
- Sicily 1862. Delicious cakes
- 【PA2009】【BZOJ3498】Cakes
- 3072: [Pa2012]Two Cakes
- HDU5997 rausen loves cakes
- [bzoj3072]Two Cakes
- bzoj4232 Kids Like Cakes
- BZOJ 3072 Two Cakes
- codechef Arranging Cup-cakes题解
- nyoj cakes 1163 (排序) 水
- 【BZOJ3072】[Pa2012]Two Cakes【DP】
- HDU 5997 rausen loves cakes
- hdu 5997 rausen loves cakes
- HDU 5997 rausen loves cakes
- hdu 5997 rausen loves cakes
- A. Carrot Cakes Codeforce 思维
- Java不同类型字符转换String/int/Float/////
- SpringBoot学习-(九)SpringBoot中的AOP
- String,对象,Map,json互转封装类
- 数据结构—线性表—八进制数加法
- [ReactNative]ViewPager不显示图片
- cakes
- ajax response 导出文件
- 机器学习实践-k近邻算法-约会网站配对源码
- can't start git:usr/bin/git
- 通过函数给指针申请内存时遇到的内存泄漏问题
- js的slice,substring,substr,split用法
- 取double类型的几位有效数字
- 关于Toolbar的使用小结
- LeetCode231 Power of Two