Advertisement
Mirnijat

adGunleri

Mar 13th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner scan = new Scanner(System.in);
  7.  
  8.         int adGunuSayi = scan.nextInt();
  9.         int arr[] = new int[adGunuSayi];
  10.         int count = 0;
  11.         boolean unique = true;
  12.  
  13.         for (int i = 0; i < arr.length; i++){
  14.             arr[i] = scan.nextInt();
  15.             for (int j = 0; j<i; j++){
  16.                 if (arr[i] == arr[j]){
  17.                     unique = false;
  18.                     break;
  19.                 }
  20.                 else{
  21.                     unique = true;
  22.                 }
  23.             }
  24.             if (unique){
  25.                 count++;
  26.             }
  27.         }
  28.  
  29.         System.out.println(count);
  30.     }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement