Skip to content

Instantly share code, notes, and snippets.

@TPAKC
Created April 17, 2015 13:50
Show Gist options
  • Save TPAKC/7e483c0106ad0ba3558f to your computer and use it in GitHub Desktop.
Save TPAKC/7e483c0106ad0ba3558f to your computer and use it in GitHub Desktop.
import java.util.*;
import java.io.IOException;
public class vidrizki {
public static void main (String[] args) throws IOException
{
Scanner in = new Scanner(System.in);
int a = in.nextInt();
HashSet<Long> array = new HashSet<Long>();
for (int i = 0; i <a; i++) {
long b = in.nextLong();
long c = in.nextLong();
for (long j = b,p=1; j <=c; j+=p) {
if(j%5==0)
{
System.out.println(j);
array.add(j);
p=5;
}
}
}
System.out.println(array.size());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment