Devcpp is easy to sort. devcpp is simple to sort.
What I learned before, I don't know what is missing, nothing is missing, simply start to get it again, using "Aha! Algorithm.
Sorting is very simple. You can choose to stick to it if it is small. Paste a copy of the Code directly.
#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>using namespace std;int a[10001]={0};int n;int t;int main(){ scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%d",&t); a[t]++; } for(int j=1;j<=10000;j++){ if(a[j]>0) printf("%d ",j); } return 0;}
This is the simplest method of getting rid of it. If it is hard to add it directly, it will be output if it is greater than 0. Generally, small programs do not need to consider the time limit.
Next, it is sort.
#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>using namespace std;int n;int a[10001];int main(){ scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%d",&a[i]); } sort(a+1,a+n+1); for(int j=1;j<=n;j++){ printf("%d ",a[j]); } return 0;}
It seems that sort is simpler.
Void Sort () {// bubble Sort for (int I = 1; I <= n-1; I ++) {for (int j = 1; j <= n-I; j ++) {if (a [j]> a [j + 1]) {int t = a [j]; a [j] = a [j + 1]; a [j + 1] = t ;}}}}
Finally, the Bubble Sorting is added, so this is the end of writing.
2017-04-01
18:19:26