Last active
August 29, 2015 14:04
-
-
Save chomado/2c59e5ce6cdb02847ae5 to your computer and use it in GitHub Desktop.
[AOJ] 5つの整数を降順に表示する。問題: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0018
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <algorithm> | |
#include <vector> | |
using namespace std; | |
int main() | |
{ | |
int input; | |
vector<int> array; | |
for (int i=0; i<5; ++i) { | |
cin >> input; | |
array.push_back(input); | |
} | |
sort(array.begin(), array.end(), greater<int>()); | |
for (vector<int>::size_type i=0; i<array.size(); ++i) { | |
cout << array[i]; | |
cout << (i==4 ? '\n' : ' '); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
accepted: http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=1036765
Sample Input
3 6 9 7 5
Output for the Sample Input
9 7 6 5 3