Advertisement
Guest User

awdawd

a guest
Feb 17th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3. using namespace std;
  4. int n;
  5. float V[2][30];
  6.  
  7. int read_data()
  8. {
  9. ifstream fin("intrare.in");
  10. ofstream fout("iesire.out");
  11. fin>>n;
  12. for(int x = 1;x<=n;x++)
  13. {
  14. for(int y = 1;y<=2;y++)
  15. {
  16. fin>>V[y][x];
  17. }
  18. }
  19. }
  20. int compute_data()
  21. {
  22. float remain = 0;
  23. int time = 0;
  24. for(int x = 1;x<=n;x++)
  25. {
  26. remain = 0;
  27. time = 0;
  28. if(V[2][x]>=0.6)
  29. {
  30. remain=V[2][x];
  31. cout<<remain<<endl;
  32. cout<<remain-(0.6)<<endl;
  33. while(remain>0)
  34. {
  35. remain-=0.6;
  36. time++;
  37. }
  38. cout<<time<<" "<<remain;
  39. cout<<endl;
  40. V[2][x] = 1*time+remain;
  41.  
  42. }
  43. }
  44. }
  45.  
  46. int main()
  47. {
  48. read_data();
  49. compute_data();
  50. ///verificare
  51. for(int x = 1;x<=n;x++)
  52. {
  53. for(int y = 1;y<=2;y++)
  54. {
  55. cout<<V[y][x]<<" ";
  56. }
  57. cout<<endl;
  58. }
  59. ///----------
  60.  
  61.  
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement