Advertisement
a53

paralele

a53
Jan 26th, 2017
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <fstream>
  2.  
  3. using namespace std;
  4. ifstream f("paralele.in");
  5. ofstream g("paralele.out");
  6. long a[1001] , v[2000001] , n , i , j , x , maxim ;
  7.  
  8. int main()
  9. {
  10. f >> n ;
  11. maxim = 0 ;
  12. for ( i=1 ; i<=n ; i++ )
  13. {
  14. f >> a[i] ;
  15. for ( j=1 ; j<i ; j++ )
  16. {
  17. if( a[i]>a[j] ) x = a[i]-a[j];
  18. else x = a[j]-a[i];
  19. v [x]++ ;
  20. if ( v[x] > maxim ) maxim = v[x] ;
  21. }
  22. }
  23. g << maxim ;
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement