fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. long long int n, v[65535], mini, putere = 1, cif = 1, cif2, putere2;
  6.  
  7. int main()
  8. {
  9. cin >> n;
  10. cin >> v[1];
  11. mini = v[1];
  12. for (int i = 2; i <= n; ++i) {
  13. cin >> v[i];
  14. if (v[i] < mini)
  15. mini = v[i];
  16. }
  17. while (cif < mini) {
  18. ++putere;
  19. cif += putere;
  20. }
  21. for (int i = 1; i <= n; ++i) {
  22. cif2 = cif;
  23. putere2 = putere;
  24. while (cif2 < v[i] - 1) {
  25. ++putere2;
  26. cif2 += putere2;
  27. }
  28. if (v[i] == cif2 + 1)
  29. cout << 1 << ' ';
  30. else
  31. cout << 0 << ' ';
  32. }
  33. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
Standard output is empty