import java.util.Scanner;
public class Solution {
public static void main(String[] args){
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int T;
T=Integer.parseInt(sc.nextLine());
for(int test_case = 1; test_case <= T; test_case++)
{
int N = Integer.parseInt(sc.nextLine());
int[] arr = new int[N];
for(int i=0; i<N; i++) {
arr[i]=Integer.parseInt(sc.nextLine());
}
int count = 0;
for(int i=1; i<N; i++) {
if(arr[i]==0) continue;
int day=arr[i]-1; //주기
count ++;
for(int j=i+1; j<N; j++) { //돌면서 저 주기 체크~
if((arr[j]-1)%day==0) arr[j]=0; //방문 표시
}
}
System.out.println("#"+test_case+" "+count);
}
}
}
나는 몽총이 ~
나머지 연산으로 저리 샥 샥 ,,
방문도 걍 0 으로 표시 하면 되는데 ~~~~~~~ 아아악
'NOTE > SWEA' 카테고리의 다른 글
14361. 숫자가 같은 배수 -d3 (0) | 2022.06.10 |
---|---|
9480. 민정이와 광직이의 알파벳 공부 - d3 (0) | 2022.06.09 |
8016. 홀수 피라미드 - d3 (0) | 2022.06.06 |
9940. 순열1 - d3 (0) | 2022.06.04 |
1859. 백만 장자 프로젝트 - D2 (0) | 2022.05.27 |