• + 0 comments

    My solution in C,passed all test cases..

    int main()

    {

    int n; 
    
    int k;
    
    int count=0;
    
    scanf("%d %d",&n,&k);
    
    int a[100];
    
    for(int i = 0; i < n; i++)
    {
    
       scanf("%d",&a[i]);
    
    }
    for(int i=0;i<n;i++)
    
        {
    
        for(int j=i+1;j<n;j++)
    
            {
    
            if((a[i]+a[j])%k==0)
    
                count++;
    
        }
    }
    
    printf("%d",count);
    
    return 0;
    

    }