/* #include <stdio.h> typedef struct { int num; int a; int b; } abc; int main() { int i, j, k = 0, n,m=0; abc arr[1001] = {}, temp; scanf("%d", &n); for (i = 1; i <= n; i++) { scanf("%d %d", &arr[i].a, &arr[i].b); arr[i].num = i; } for (i = 1; i < n; i++) { m=0; for (j = 1; j <= n-i; j++) { if (arr[j].a > arr[j + 1].a) { temp=arr[j]; arr[j]=arr[j+1]; arr[j+1]=temp; m++; } else if (arr[j].a == arr[j + 1].a) { if (arr[j].b > arr[j+1].b) { temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; m++; } else if (arr[j].b == arr[j + 1].b) { if (arr[j].num < arr[j+1].num) { temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; m++; } } } } if (m == 0) { break; } } for (i=n ; i>=1 ; i--) { k++; printf("%d %d %d\n",arr[i].num,arr[i].a, arr[i].b); } } #include<stdio.h> typedef struct { char str[51]; int a; }abc; int main() { int i,j,n,m=0; abc arr[51], temp; scanf("%d",&n); for (i=1;i<=n;i++) { scanf("%s %d",arr[i].str,&arr[i].a); } for (i=1;i<n;i++) { m=0; for (j=1;j<=n-i;j++) { if (arr[j].a < arr[j+1].a) { temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; m++; } } if (m==0) { break; } } printf("%s",arr[3].str); } #include<stdio.h> int main() { int i,j,k,n,m; int arr[100001]={}; scanf("%d",&n); for (i=1;i<=n;i++) { scanf("%d",&k); arr[k]++; } for (i=0;i<=100000;i++) { for (j=1;j<=arr[i];j++) { printf("%d ", i); } } } */ #include <stdio.h> int a[10001]; int n, i, j, temp, min; int main() { scanf("%d", &n); for (i = 1; i <= n; i++) scanf("%d", &a[i]); for (i = 1; i < n; i++) { min = i; for (j = i + 1; j <= n; j++) { } temp = a[i]; a[i] = a[min]; a[min] = temp; } for (i = 1; i <= n; i++) printf("%d\n", a[i]); return 0; }
top of page

bottom of page


