fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int arr[] ={1,1,1,1,2,2};
  13. int c=0,k1=1,k2=3;
  14. int n=arr.length;
  15. for(int i=0;i<n;i++){
  16. for(int j=i+1;j<n;j++){
  17. for(int k=j+1;k<n;k++){
  18. for(int l=k+1;l<n;l++){
  19. if(arr[i]+arr[j] > k1 && arr[k]+arr[l] > k2){
  20. c++;
  21. }
  22. }
  23.  
  24. }
  25. }
  26. }
  27. System.out.println(c);
  28. }
  29. }
Success #stdin #stdout 0.07s 52420KB
stdin
Standard input is empty
stdout
6