mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 1879.cpp
This commit is contained in:
parent
ec4354b880
commit
c414226d51
27
QUSTOJ/1879.cpp
Normal file
27
QUSTOJ/1879.cpp
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user