-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInsomniacure.java
More file actions
32 lines (30 loc) · 771 Bytes
/
Insomniacure.java
File metadata and controls
32 lines (30 loc) · 771 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
25
26
27
28
29
30
31
32
import java.util.Arrays;
import java.util.Scanner;
public class Insomniacure {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int k=sc.nextInt();
int l=sc.nextInt();
int m=sc.nextInt();
int n=sc.nextInt();
int d=sc.nextInt();
boolean arr[]=new boolean[d+1];
Arrays.fill(arr, false);
for(int i=k;i<=d;i+=k)
arr[i]=true;
for(int i=l;i<=d;i+=l)
arr[i]=true;
for(int i=m;i<=d;i+=m)
arr[i]=true;
for(int i=n;i<=d;i+=n)
arr[i]=true;
int ans=0;
for(int i=0;i<arr.length;i++)
{
if(arr[i])
ans++;
}
System.out.println(ans);
sc.close();
}
}