Advertisement
Guest User

Bla

a guest
Jun 24th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n,i;
  8. float ogr,ogm,oga,r[50],m[50],ap[50],vt[50],kraca;
  9.  
  10. cin>>n;
  11. cin>>ogr>>ogm>>oga;
  12. for(i=0;i<n;i++)
  13. {
  14. cin>>r[i]>>m[i]>>ap[i];
  15. }
  16. for(i=0;i<n;i++)
  17. {
  18. vt[i]=r[i]/ogr + m[i]/ogm + ap[i]/oga;
  19. }
  20. for(i=0;i<n;i++)
  21. {
  22. kraca=vt[i];
  23. if(vt[i]<kraca)
  24. kraca=vt[i];
  25. }
  26.  
  27. cout<<"Najbrza je ruta ";
  28. for(i=0;i<n;i++)
  29. {
  30. if(kraca==vt[i])
  31. {
  32. cout<<i+1<<" ";
  33. }
  34. }
  35. cout<<endl;
  36. cout<<"Vremena trajanja putovanja su ";
  37. for(i=0;i<n;i++)
  38. {
  39. cout<<fixed<<setprecision(2)<<vt[i]<<" ";
  40. }
  41. cout<<"sati";
  42.  
  43. system("pause");
  44. return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement