Advertisement
Guest User

15 HARD

a guest
Feb 20th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. double mx = 0;
  9. int n, mxIndex = 0;
  10. cin >> n;
  11. int a[n * 3];
  12. for(int i = 0; i < n * 3; i++){
  13. cin >> a[i];
  14. }
  15. for(int i = 0; i < n * 3; i += 3){
  16. double r = sqrt(a[i] * a[i] + a[i + 1] * a[i + 1] + a[i + 2] * a[i + 2]);
  17. if(r > mx){
  18. mx = r;
  19. mxIndex = i;
  20. }
  21. }
  22.  
  23. cout << (mxIndex / 3) + 1 << ") " << a[mxIndex] << " " << a[mxIndex + 1] << " " << a[mxIndex + 2];
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement