-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVaccine1.java
More file actions
24 lines (21 loc) · 741 Bytes
/
Vaccine1.java
File metadata and controls
24 lines (21 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.io.*;
import java.util.*;
class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int D1 = Integer.parseInt(st.nextToken());
int V1 = Integer.parseInt(st.nextToken());
int D2 = Integer.parseInt(st.nextToken());
int V2 = Integer.parseInt(st.nextToken());
int P = Integer.parseInt(st.nextToken());
int d = 0;
int total = 0;
while(total < P) {
d=d+1;
if(d >= D1) total = total + V1;
if(d>=D2) total = total + V2;
}
System.out.println(d);
}
}