-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fertilizer.cpp
44 lines (43 loc) · 868 Bytes
/
Fertilizer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "iostream"
using namespace std;
int main() {
int day= 1,high,excepthigh,a;
cin >> high >> excepthigh >> a;
while(true) {
if (a <= 0){
cout << "unsalable";
break;
}else if(day % 8 == 0 ){
if(high < excepthigh){
a = a-1;
day = day +1;
continue;
}else if(high >= excepthigh){
cout << day+3;
break;
}
}else if(day % 3 == 0) {
high = high + (high/3);
if (high >= excepthigh) {
cout << day+1;
break;
}else{
day = day +1;
}
}else if(high < excepthigh) {
high = high + (high/10);
if (high >= excepthigh){
cout << day;
break;
}else {
day = day + 1;
}
}else if(high >= excepthigh){
cout << day;
break;
}else{
cout << "unsaleable";
break;
}
}
}