D.cpp 308 B

123456789101112131415
  1. #include<iostream>
  2. using namespace std;
  3. int main(int argc, char const *argv[]) {
  4. for (int n; cin >> n;) {
  5. if (n == 1)
  6. cout << 1 << endl;
  7. else if (n < 4 || n % 4 != 0)
  8. cout << -1 << endl;
  9. else
  10. cout << (n / 4) + 1 << endl;
  11. }
  12. return 0;
  13. }