求代码

haimoxiaoen 2021-07-15 14:59:15 6

求代码,谢谢

{{ vote && vote.total.up }}

共 3 条回复

ykj05

#include <bits/stdc++.h> using namespace std; queue man, w; int main() { freopen("D.in","r",stdin); freopen("D.out","w",stdout); int n, m, k; cin >> n >> m >> k; for(int i=1;i<=n;i++) man.push(i); for(int i=1;i<=m;i++) w.push(i); while(k--){ printf("%d %d\n",man.front(), w.front()); man.push(man.front()); man.pop(); w.push(w.front()); w.pop(); } return 0; }

ykj05
Yang_

用队列