fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. ios::sync_with_stdio(false);
  6. cin.tie(nullptr);
  7.  
  8. int a, b, c;
  9. cin >> a >> b >> c;
  10.  
  11. int x = max(0, a + b - c);
  12. int y = c - x;
  13. int z = a - x;
  14. int w = b - x;
  15.  
  16. if (y < 0) y = 0;
  17. if (z < 0) z = 0;
  18. if (w < 0) w = 0;
  19.  
  20. string A = string(y, '0') + string(w, '1') + string(x, '0');
  21. string B = string(y, '0') + string(z, '0') + string(x, '0');
  22. string C = string(z, '1') + string(w, '1') + string(x, '0');
  23.  
  24. cout << A << "\n" << B << "\n" << C << "\n";
  25.  
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0.01s 5316KB
stdin
4 2 3
stdout
000
0000
1000