-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVACCINE1.cpp
75 lines (75 loc) · 998 Bytes
/
VACCINE1.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
while(1)
{
float d1,v1,d2,v2,p;
cin>>d1>>v1>>d2>>v2>>p;
if(d1==1 && d2==1)
{
float x=v1+v2;
float res = p/x;
cout<<ceil(res);
break;
}
if(d2<d1)
{
float s;
s=v1+v2;
int t=0,i=1;
while(i)
{
if(t>=p)
{
cout<<i-1;
break;
}
if(i>=d2)
{
t +=v2;
if(i>=d1)
{
t+=v1;
}
}
i+=1;
}
break;
}
if(d1<d2)
{
float s;
s=v1+v2;
int t=0,i=1;
while(i)
{
if(t>=p)
{
cout<<i-1;
break;
}
if(i>=d1)
{
t +=v1;
if(i>=d2)
{
t+=v2;
}
}
i+=1;
}
break;
}
if(d1==d2)
{
float s=0,t;
s=v1+v2;
t=p/s;
if(d1>1) s=(d1-1);
cout<<ceil(t)+s;
break;
}
}
return 0;
}