You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
451 B

#include <iostream>
using namespace std;
int n, cnt;
int main() {
cin >> n;
if (n == 2)
cnt = -1;
else if (n == 4)
cnt = 4;
else if (n == 5)
cnt = 3;
else if (n == 7)
cnt = 3;
else if (n % 3 == 0)
cnt = n / 3;
else if (n % 3 == 1)
cnt = (n - 7) / 3 + 3;
else if (n % 3 == 2)
cnt = (n - 5) / 3 + 3;
cout << cnt << endl;
return 0;
}