Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
103455 汤弘毅 18排列骨头 C++ Accepted 1 MS 272 KB 787 2024-12-28 17:10:47

Tests(1/1):


Code:

#include <iostream> #include <stack> #include <queue> #include <algorithm> using namespace std; struct stu{ char name; int number,age,Chinese,maths,English; }; queue <int> q; int main(){ //栈 stack //用法 /*s.push(1); s.pop(); s.top(); s.empty(); s.size(); s.clear(); */ //队列 queue //用法 /*q.push(1); q.pop(); q.front(); q.empty(); q.size(); q.clear() */ int c; int t=0; for(int i=1;i<=30;i++){ q.push(i); } while(q.size()!=15){ t = t+1; if(t==9){ q.pop(); t=0; } else{ c=q.front(); q.pop(); q.push(c); } } int a[10000]; for(int i=0;i<=14;i++){ a[i] = q.front(); q.pop(); } sort(a,a+15); for(int i=0;i<=14;i++){ cout<<a[i]<<" "; } }