Created
          August 24, 2021 01:02 
        
      - 
      
- 
        Save esthicodes/eea75db8df27e602681f98c8a9ddc1ac to your computer and use it in GitHub Desktop. 
    hackerrank
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include<stdio.h> | |
| #include<string.h> | |
| #include<math.h> | |
| #include<stdlib.h> | |
| #include<assert.h> | |
| #include<limits.h> | |
| #include<stdbool.h> | |
| int main () | |
| { | |
| int n; | |
| int k; | |
| scanf("%d %d",&n,&k); | |
| int *a = malloc(sizeof(int) * n); | |
| for(int a_i = 0; a_i < n; a_i++){ | |
| scanf("%d",&a[a_i]); | |
| } | |
| int sum = 0; | |
| for (int i = 0; i < n; i++) { | |
| for (int j = i+1; j < n; j++) { | |
| if ( (a[i]+a[j])%k == 0) | |
| sum++; | |
| } | |
| } | |
| printf("%d\n",sum); | |
| return 0; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment