Advertisement
Guest User

Untitled

a guest
Oct 17th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main(){
  4. // Fuel=3*(r[i]-r[j+1])^(1/2)+2*abs((2*k[i]-2*k[i+1])*(2*k[i]+2*k[i+1]))+5*abs(year[i]-year[i+1]);
  5. int numb;
  6. cin >> numb;
  7. int planets [numb] [4];
  8. long fuel_min;
  9. int str =3;
  10. int temp;
  11. int sum=0;
  12. long Fuel=0;
  13. for (int i=0;i<numb;i++)
  14. {
  15. cin>>planets [i] [0];//r
  16. cin>>planets [i] [1];//k
  17. cin>>planets [i] [2];//j
  18. planets[i] [3] = planets [i] [0]+planets [i] [1]+planets [i] [2];
  19. }
  20. for(int c=0;c<=(str*numb);c++)
  21. {
  22. for(int x=0;x<str;x++)
  23. {
  24. for(int z=0;z<numb-1;z++)
  25. {
  26. if(planets[z][x]>planets[z][x+1])
  27. {
  28. temp=planets[z][x];
  29. planets[z][x]=planets[z][x+1];
  30. planets[z][x+1]=temp;
  31. }
  32. }
  33. }
  34. }
  35. for(int a=0;a<numb;a++){
  36. //sum=sum+3*(planets[a][0]-planets[a+1][0])^(1/2)+2*abs((2*planets[a][1]-2*planets[a+1][1])*(2*planets[a][1]+2*planets[a+1] [1]))+5*abs(planets[a][2]-planets[a+1][2]);
  37. cout<<planets[a][0]<<planets[a][1]<<planets[a][2]<<endl;
  38. }
  39.  
  40. //cout<<-sum;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement