This code Is wrong yet the output is right

#include <stdio.h>
#include <stdlib.h>
int main(void) {
	int T , N  , i , j , m , mul ,k, count ;
	scanf("%d" , &T);
	while(T--){
	    count = 0 ; 
	    scanf("%d"  ,  &N);
	    int *p;
	    p = (int *)malloc(N * sizeof(int));
	    for(k = 0 ; k < N ; k++){
	        scanf("%d" , &p[k]);
	    }
	    for(i = 0 ; i < N - 1 ; i++){
	        for(j = i+1 ; j<N ; j++){
	            mul = p[i] * p[j];
	        }
	        for(m = 0 ; m < N ; m++){
	            if(mul == p[m]){
	               count += 1 ;
	               mul = 0 ; 
	            }
	        }
	    }
	    if(count > 0){
	        printf("yes\n");
	    }
	    else if(count == 0 ){
	        printf("no\n");
	    }
	}
	return 0;
}

pls help me in understanding the main problem the code of the problem is ICPC16B

the solution CodeChef: Practical coding for everyone

Why duplicate the same topic?

1 Like