码迷,mamicode.com
首页 > 其他好文 > 详细

CCF 20170302 学生排队

时间:2020-04-13 01:17:04      阅读:75      评论:0      收藏:0      [点我收藏+]

标签:clu   std   include   tor   iostream   space   stream   str   names   

#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

const int N = 1000;
vector<int> v(N);

int main(){
    int n, m;
    cin>>n>>m;
    for(int i = 0; i < n; i++){
        v[i] = i + 1;
    }
    int p,q;
    for(int i = 0; i < m; i++){
        cin>>p>>q;
        vector<int> :: iterator it =find(v.begin(),v.end(),p);
        v.erase(it);
        v.insert(it + q, p);
    }
    for(int i = 0; i < n; i++){
        cout<<v[i]<<‘ ‘;
    }
    return 0;
}

CCF 20170302 学生排队

标签:clu   std   include   tor   iostream   space   stream   str   names   

原文地址:https://www.cnblogs.com/blink-cz/p/12688676.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!