Create 1879.cpp

This commit is contained in:
Kirigaya Kazuto 2016-11-17 09:41:52 +08:00 committed by GitHub
parent ec4354b880
commit c414226d51

27
QUSTOJ/1879.cpp Normal file
View File

@ -0,0 +1,27 @@
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n;
cin>>n;
int tmp;
vector<int> vec;
for(int i=0;i<n;i++)
{
cin>>tmp;
vec.push_back(tmp);
}
int p;
cin>>p;
tmp=vec.at(p-1);
vec.at(p-1)=vec.at(p-2);
vec.at(p-2)=tmp;
for(int i=n-1;i>=1;i--)
{
cout<<vec.at(i)<<" ";
}
cout<<vec.at(0)<<endl;
return 0;
}