fork(4) download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. double x;
  7. cin >> x;
  8. if (x < 0){
  9. cout << 0;
  10. }else if ((int)x % 2 == 0 || x < (int)x / 2 + 1){
  11. cout << 1;
  12. }else{
  13. cout << -1;
  14. }
  15. return 0;
  16. }
Success #stdin #stdout 0s 5320KB
stdin
4.999
stdout
1