Advertisement
Saleh127

CF 1003B

Aug 2nd, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. ios_base::sync_with_stdio(0);
  6. cin.tie(0);
  7. cout.tie(0);
  8.  
  9. int a,c,d,e,x,i,j,k,l;
  10. char n,m;
  11. cin>>a>>c>>x;
  12. d=a+c;
  13. if(a>c)
  14. {
  15. n='0';
  16. m='1';
  17. }
  18. else
  19. {
  20. n='1';
  21. m='0';
  22. swap(a,c);
  23. }
  24. for(i=0; i<x/2; i++)
  25. {
  26. cout<<n<<m;
  27. a--;
  28. c--;
  29. }
  30. if(x%2==0)
  31. {
  32. while(c--)
  33. {
  34. cout<<m;
  35. }
  36. while(a--)
  37. {
  38. cout<<n;
  39. }
  40. }
  41. else
  42. {
  43. while(a--)
  44. {
  45. cout<<n;
  46. }
  47. while(c--)
  48. {
  49. cout<<m;
  50. }
  51. }
  52. return 0;
  53. }
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement