Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.Scanner;
- //import java.io.File;
- import static sun.nio.ch.IOStatus.EOF;
- public class Main {
- public static void main(String[] args) throws IOException{
- Scanner in=new Scanner(System.in);
- InputStreamReader es=new InputStreamReader(System.in);
- BufferedReader br=new BufferedReader(es);
- int test=in.nextInt();
- for (int t = 0; t <test ; t++) {
- int x=in.nextInt();
- int y=in.nextInt();
- int target=0;
- for (int i = x; i <=y ; i++) {
- double m=(double)i;
- double n=Math.sqrt(m);
- int z=(int)n;
- int count=0;
- for (int j = 1; j <=z ; j++) {
- if(i%j==0){
- if(j%2==1){
- count++;
- }
- int d=i/j;
- if(d!=j){
- if(d%2==1){
- count++;
- }
- }
- }
- }
- if(count%2==1){
- target++;
- }
- }
- System.out.println(target);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement