fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Codechef
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. /*
  10. number of unordered quadruplets (i,j,k,l) such that b[i] + b[j] + b[k] + b[l] = 0
  11. ~ code by roshanadhav
  12.  
  13. */
  14.  
  15.  
  16. //O(n^4) ;
  17. Scanner sc = new Scanner(System.in) ;
  18. int n = sc.nextInt() ;
  19. int arr[] = new int[n] ;
  20.  
  21. for(int i = 0 ; i < n ; i++) {
  22. arr[i] = sc.nextInt() ;
  23. }
  24.  
  25. for(int i = 0 ; i < n ; i++) {
  26. for(int j = i + 1 ; j < n ; j++) {
  27. for(int k = j + 1 ; k < n ; k++) {
  28. for(int l = k+1 ; l < n ; l++) {
  29. if(arr[i] + arr[j] + arr[k] + arr[l] == 0) count++ ;
  30. }
  31. }
  32. }
  33. }
  34.  
  35. System.out.println(count);
  36. }
  37. }
  38.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:29: error: cannot find symbol
	                    if(arr[i] + arr[j] + arr[k] + arr[l] == 0) count++ ; 
	                                                               ^
  symbol:   variable count
  location: class Codechef
Main.java:35: error: cannot find symbol
	    System.out.println(count);
	                       ^
  symbol:   variable count
  location: class Codechef
2 errors
stdout
Standard output is empty