#include <stdio.h>
#include <stdlib.h>
int main(){
int N, valores[10000], i, j, pontuacao=0;
scanf("%d", &N);
for (i=0; i<N; i++){
scanf("%d", &valores[i]);
}
for(i=0; i<N; i++){
for(j=i+1; j<N; j++){
if (valores[i] == valores[j])
pontuacao++;
}
}
printf("%d", pontuacao);
return 0;
}
It’s supposed to be returning the number of points in a sequence of consecutive numbers, example:
- input:
11 (N) 30 30 30 40 40 40 40 40 30 30 30
- output:
25
(supposed to be 5)
The strange thing is that it works for other sequences.
New contributor
Renan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1