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
'PS > BaekJoon' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
2675 JAVA ๋ฌธ์์ด ๋ฐ๋ณต (0) | 2022.06.30 |
---|---|
10950 JAVA A+B - 3 (0) | 2022.06.30 |
2439 JAVA ๋ณ์ฐ๊ธฐ -2 (0) | 2022.06.22 |
10699 JAVA ์ค๋ ๋ ์ง (0) | 2022.06.20 |
2420 JAVA ์ฌํ๋ฆฌ์๋ (0) | 2022.06.20 |