#include<iostream>
#include<vector>
using namespace std;
int main()
{
long long n,h;
while(cin>>n){
if(n==0) break;
vector<int> coll;
unsigned int i;
for(i=1; i <= n; ++i)
{
cin>>h;
coll.push_back(h);
}
vector<int>::iterator iter;
for( iter = coll.end(); iter != coll.begin(); iter-- ) {
cout << *iter <<" ";
}
}
return 0;
}
Problem: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2457
#include<vector>
using namespace std;
int main()
{
long long n,h;
while(cin>>n){
if(n==0) break;
vector<int> coll;
unsigned int i;
for(i=1; i <= n; ++i)
{
cin>>h;
coll.push_back(h);
}
vector<int>::iterator iter;
for( iter = coll.end(); iter != coll.begin(); iter-- ) {
cout << *iter <<" ";
}
}
return 0;
}
Problem: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2457
No comments:
Post a Comment
Thank you for commenting. Please wait for response :)