Codeforces 246A-Buggy Sorting【模拟】

灰太狼 2022-08-21 13:43 73阅读 0赞

A. Buggy Sorting

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, …, a**n in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of the program gets number n and array a.

  1. loop integer variable i from 1 to n - 1
  2. loop integer variable j from i to n - 1
  3. if (aj > aj + 1), then swap the values of elements aj and aj + 1

But Valera could have made a mistake, because he hasn’t yet fully learned the sorting algorithm. If Valera made a mistake in his program, you need to give a counter-example that makes his program work improperly (that is, the example that makes the program sort the array not in the non-decreasing order). If such example for the given value of n doesn’t exist, print -1.

Input

You’ve got a single integer n (1 ≤ n ≤ 50) — the size of the sorted array.

Output

Print n space-separated integers a1, a2, …, a**n (1 ≤ a**i ≤ 100) — the counter-example, for which Valera’s algorithm won’t work correctly. If the counter-example that meets the described conditions is impossible to give, print -1.

If there are several counter-examples, consisting of n numbers, you are allowed to print any of them.

Examples

input

  1. 1

output

  1. -1
  2. 解题思路:
  3. 上面是一个人写的错误的将一个序列排成递增序列的代码,我们要找到反例,如果找不到就输出-1.
  4. #include<stdio.h>
  5. int main()
  6. {
  7. int n;
  8. while(scanf("%d",&n)!=EOF)
  9. {
  10. if(n<=2)
  11. {
  12. printf("-1\n");
  13. continue;
  14. }
  15. for(int i=1;i<n;i++)
  16. {
  17. printf("%d ",i+1);
  18. }
  19. printf("1\n");
  20. }
  21. return 0;
  22. }

发表评论

表情:
评论列表 (有 0 条评论,73人围观)

还没有评论,来说两句吧...

相关阅读

    相关 [uoj#246]套路

    部分分$3:m<=1000$ 当$m>1000$时,必有两个跳蚤的值相同,所以只要枚举$m<=1000$的区间 转载于:https://www.cnblogs.com/lx