2 条题解

  • 2
    @ 2025-7-22 14:35:24

    #include<bits/stdc++.h> using namespace std; int l,o,m; queue man; queue noman; int main(){ cin>>l>>o; cin>>m; for(int i=1;i<=l;i++){ man.push(i); } for(int i=1;i<=o;i++){ noman.push(i); } for(int j=1;j<=m;j++){ cout<<man.front()<<' '<<noman.front()<<endl; man.push(man.front()); man.pop(); noman.push(noman.front()); noman.pop(); }

    return 0;
    

    }

    • 1
      @ 2025-7-22 15:45:17

      #include<bits/stdc++.h>

      using namespace std;

      queue q,p; //q是man,p是nv

      int man,nv,qm,cnt=0,qmd;

      int main(){

      cin>>man>>nv>>qm;
      qmd=qm;
      while(qm--){
      	cnt++;
      	if(cnt%man){
      		q.push(cnt%man);
      	}
      	else{
      		q.push(man);
      	}
      	if(cnt%nv){
      		p.push(cnt%nv);
      	}
      	else{
      		p.push(nv);
      	}
      	cout<<q.front()<<" "<<p.front()<<endl;
      	q.pop();
      	p.pop();
      }
      return 0;
      

      }

      • 1

      信息

      ID
      547
      时间
      1000ms
      内存
      256MiB
      难度
      10
      标签
      递交数
      6
      已通过
      4
      上传者