Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int n, k, r, ak, bk, sumak, ar, br, sumar, i, j, l=0;
- int main()
- {
- cin>>n>>k>>r;
- if(n%2==0)
- cout<<n/2<<'\n';
- else
- cout<<(n-1)/2<<'\n';
- ak=(k*(k-1))/2;
- bk=ak+k-1;
- ar=(r*(r-1))/2;
- br=ar+r-1;
- sumak=((ak+bk)*k)/2;
- sumar=((ar+br)*r)/2;
- cout<<(sumak+sumar)/(k+r)<<'\n';
- i=ar;
- j=br;
- while(i<j)
- {
- cout<<i<<" ";
- i++;
- cout<<i<<" ";
- i++;
- if(j>i)
- cout<<j<<" ", j--;
- }
- if(i==j)
- cout<<i<<" ";
- return 0;
- }
Add Comment
Please, Sign In to add comment