hwangnk1004 / Algorithm

0 stars 0 forks source link

StepByStep #doubles #274

Open hwangnk1004 opened 4 years ago

hwangnk1004 commented 4 years ago

import java.util.Scanner;

public class Main { public static void main(String args[]) {

    Scanner scanner = new Scanner(System.in);

    int[] arr = new int[16];
    int[] arr2= new int[16];
    int count = 0;
    int count2= 0;
    while (true){
        int n = scanner.nextInt();
        if (n==0) {
            break;
        }
        arr[count++] = n;
        arr2[count2++] = n*2;
    }

    int x = 0;

    for(int i=0; i<count; i++) {
        for(int j=0; j<count2; j++){
            if (arr[i] == arr2[j]) {
                x++;
            }
        }
    }
    System.out.println(x);

}

}