fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n;
  6. cin >> n;
  7. int odd = n % 2;
  8. for (int i=0; i<n; i++) {
  9. if (((i + 1 - odd) % 4) / 2)
  10. cout << "1";
  11. else
  12. cout << "0";
  13. }
  14. //bonus: difference
  15. cout << "\n" << (n + 1) % 4 / 2;
  16. return 0;
  17. }
Success #stdin #stdout 0s 4388KB
stdin
8
stdout
01100110
0