lukadupli

Maliand

Nov 17th, 2022
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | Source Code | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. const int MAXN = 5e5 + 5;
  6.  
  7. int n, k, l;
  8. bool sol2[MAXN];
  9.  
  10. int main(){
  11. cin >> n >> k >> l;
  12.  
  13. cout << (long long)k * l / n + bool(((long long)k * l) % n) << '\n';
  14.  
  15. for(int i = 0; i < n; i++) cout << bool(i < k);
  16. cout << '\n';
  17.  
  18. int pos = 0;
  19. for(int i = 0; i < l; i++){
  20. if(sol2[pos]){
  21. pos++;
  22. pos %= n;
  23. }
  24.  
  25. sol2[pos] = true;
  26. pos += k;
  27. pos %= n;
  28. }
  29.  
  30. for(int i = 0; i < n; i++) cout << sol2[i];
  31.  
  32. return 0;
  33. }
  34.  
Add Comment
Please, Sign In to add comment