-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemsolanxuathien2.c
More file actions
40 lines (40 loc) · 843 Bytes
/
demsolanxuathien2.c
File metadata and controls
40 lines (40 loc) · 843 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>
void nhapmang(int n, int a[], int b[])
{
for (int i = 0; i < n; i++)
{
scanf("%d", &a[i]);
b[a[i]] = 1;
}
}
int main()
{
int t, c = 0;
scanf("%d", &t);
while (c < t)
{
printf("Test %d:\n", c + 1);
int n, num, k = 0;
scanf("%d", &n);
int a[100], b[100000] = {0};
nhapmang(n, a, b);
for (int i = 0; i < n; i++)
{
num = 0;
if (b[a[i]] == 1)
{
for (int j = 0; j < n; j++)
{
if (a[i] == a[j])
{
b[a[i]] = 0;
num++;
}
}
printf("%d xuat hien %d lan\n", a[i], num);
}
}
c++;
}
return 0;
}