Created
July 17, 2016 13:42
-
-
Save Jack-Saleem/373610a553b6d764799f40e520934512 to your computer and use it in GitHub Desktop.
codeforces 148A InsomniaCure program in java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class InsomniaCure | |
{ | |
public static void main(String[] args) | |
{ | |
Scanner z=new Scanner(System.in); | |
int k=z.nextInt(); | |
int l=z.nextInt(); | |
int m=z.nextInt(); | |
int n=z.nextInt(); | |
int d=z.nextInt(); | |
int[] k1=new int[d/k]; | |
int[] l1=new int[d/l]; | |
int[] m1=new int[d/m]; | |
int[] n1=new int[d/n]; | |
int flag,ans=0; | |
for(int i=1,k2=0,l2=0,m2=0,n2=0;i<=d;i++) | |
{ | |
flag=0; | |
if(i%k==0){ | |
k1[k2]=i; | |
k2++; | |
flag=1; | |
} | |
if(i%l==0){ | |
l1[l2]=i; | |
l2++; | |
flag=1; | |
} | |
if(i%m==0){ | |
m1[m2]=i; | |
m2++; | |
flag=1; | |
} | |
if(i%n==0){ | |
n1[n2]=i; | |
n2++; | |
flag=1; | |
} | |
if(flag==1) | |
ans++; | |
} | |
System.out.println(ans); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment