PS/BaekJoon
3052 JAVA ๋๋จธ์ง
chaerlo127
2022. 6. 30. 23:04
728x90
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int input = 0;
int[] a = new int [10];
for(int i = 0; i<10 ; i++) {
input = scanner.nextInt();
a[i] = input%42;
}
scanner.close();
//int count = 0;
int countPer = 0;
for(int i = 0; i<10 ; i ++) {
int count = 0;
for(int j = i+1; j<10 ; j++) {
if(a[i] == a[j]) {
count++;
}
}
if(count == 0) countPer++;
}
System.out.println(countPer);
}
}
int count๋ฅผ ์ด๊ธฐํ ํ ๋์๋ for๋ฌธ์ด ๋ฐ์ํ ๋๋ง๋ค ๋์ด์ผ ํ๋ฏ๋ก for ๋ฌธ ๋ฐ์์ ์ด๊ธฐํ ๋์ด์ผํ๋ ๊ฒ์ด ์๋,
for๋ฌธ ์์์ ์ด๊ธฐํ๊ฐ ๋์ด์ผ ํ๋ค.
728x90