parent
2905493de9
commit
83c935bfd0
@ -1,17 +1,24 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int n, cnt;
|
||||
|
||||
int main() {
|
||||
int n, cnt = 0;
|
||||
cin >> n;
|
||||
cnt = n / 3;
|
||||
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 += 1;
|
||||
cnt = (n - 7) / 3 + 3;
|
||||
else if (n % 3 == 2)
|
||||
cnt += 2;
|
||||
cnt = (n - 5) / 3 + 3;
|
||||
|
||||
cout << cnt << endl;
|
||||
return 0;
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
#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;
|
||||
}
|
Loading…
Reference in new issue