#include <iostream> #include <algorithm> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ const int k=30000; int tab[k]; int main(int argc, char *argv[]) { int n; cin>>n; for(int i=0;i<n;i++)cin>>tab[i]; sort(tab,tab+n); for(int i=n;i>0;i--)cout<<tab[i]; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include <iostream> #include <algorithm> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ const int k=30000; int tab[k]; int main(int argc, char *argv[]) { int n; cin>>n; for(int i=0;i<n;i++)cin>>tab[i]; sort(tab,tab+n); for(int i=n;i>0;i--)cout<<tab[i]; return 0; } |