forked from shivaylamba/Hacktoberfest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path254525.c
More file actions
40 lines (35 loc) · 718 Bytes
/
254525.c
File metadata and controls
40 lines (35 loc) · 718 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <stdio.h>
#include<math.h>
int main(void) {
// your code goes here
int t;
scanf("%d",&t);
for(int i=0;i<t;i++)
{
int n,m=0;
scanf("%d",&n);
int a[n],f[1000001];
for(int j=0;j<1000001;j++){
f[j]=0;
}
for(int j=0;j<n;j++){
scanf("%d",&a[j]);
}
for(int j=0;j<n;j++){
int val = f[a[j]];
for(int k=1;k<=sqrt(a[j]);k++){
if(a[j]%k==0)
{
f[k]++;
if(k!=(a[j]/k)) f[a[j]/k]++;
}
}
a[j] = val;
}
for(int j=0;j<n;j++){
if(a[j]>m) m=a[j];
}
printf("%d\n",m);
}
return 0;
}