Steven-_-AbuAlkhair's blog

By Steven-_-AbuAlkhair, history, 3 years ago, In English

in this code

main (){
    
  int n  ; cin >> n  ;
  double  arr[n] ;
  for(int i = 0 ; i < n ; i++)cin >>arr[i] ;
        int cnt  = 0; 
  for(int i = 0 ;  i < n-1  ;  i++)
  
  for(int j = i +1 ; j < n ; j ++ )
   {
       double l = log10(arr[i]+arr[j])/log10(2);
       int r = l ; 
      if(l-(double)r==0) cnt++ ;
   }
   cout<<cnt ; 
  }

when input is

4 7 3 2 1 it gives cnt = 1 because the the compiler of codeforces when arr[i] =7 and arr[j]=1 gives l=3 but r=2 ! (it dosent happen in other compilers)

even this similar code gives wa i think because of the same reason 147734731 thanks .

Full text and comments »