mirror of
https://github.com/wczffl-503/OI-Codes.git
synced 2025-07-07 18:06:58 +08:00
更新了许多
This commit is contained in:
33
数列循环左移动(队列).cpp
Normal file
33
数列循环左移动(队列).cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <stack>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
#include <queue>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
queue<int> que;
|
||||
int main(){
|
||||
int a,b;
|
||||
cin >>a>>b;
|
||||
for(int i=0;i<a;i++){
|
||||
int x;
|
||||
cin >>x;
|
||||
que.push(x);
|
||||
}
|
||||
for(int i=0;i<b;i++){
|
||||
int x=que.front();
|
||||
que.pop();
|
||||
que.push(x);
|
||||
}
|
||||
for(int i=0;i<a;i++){
|
||||
cout <<que.front()<<" ";
|
||||
que.pop();
|
||||
}
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user