3 solutions
-
0
#include<bits/stdc++.h> using namespace std; const int N=1e5+10; int a[N],b[N]; int main() { int hh=0,tt=-1,hh1=0,tt1=-1; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { a[++tt]=i; } for(int i=1;i<=m;i++) { b[++tt1]=i; } for(int i=1;i<=k;i++) { a[++tt]=a[hh]; b[++tt1]=b[hh1]; cout<<a[hh]<<" "<<b[hh1]<<endl; hh++,hh1++; } return 0; }
-
0
#include<bits/stdc++.h> using namespace std; queue<int> x,y; int main() { int a,b,n; cin>>a>>b>>n; for(int i=1;i<=a;i++) { x.push(i); } for(int i=1;i<=b;i++) { y.push(i); } for(int i=1;i<=n;i++){ cout<<x.front()<<" "<<y.front()<<endl; x.push(x.front()); y.push(y.front()); x.pop(); y.pop(); } return 0; }
- 1
Information
- ID
- 961
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 1
- Tags
- (None)
- # Submissions
- 16
- Accepted
- 11
- Uploaded By