-1
I’m trying to ask a question that if the same values are going to be counted with a single one, only I’m not getting to score as a single value.
#include <stdio.h>
int main(int argc, char** argv)
{
int a, m, i, j, cont = 0;
while(1)
{
scanf("%d %d", &a, &m);
if(a == 0 && m == 0)
break;
int vetor[m], verifica[m];
for(i = 0; i < m; i++)
{
verifica[i] = 0;
}
for(i = 0; i < m; i++)
{
scanf("%d", &vetor[i]);
}
for(i = 0; i < m; i++)
{
for(j = 0; j < m; j++)
{
if(vetor[i] == vetor[j] && verifica[i] != 1 && verifica[j] != 1)
{
cont++;
verifica[i] = 1;
verifica[j] = 1;
}
}
}
printf("%d\n", cont);
}
return 0;
}
I’m not sure what you want in the check. Want to check what are the unique values in the array? You can use an auxiliary vector to store values that do not repeat.
– Rafael Coelho