Advertisement
Guest User

Untitled

a guest
Oct 12th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1.  
  2. #include <fstream>
  3. #include <math.h>
  4. #include <iomanip>
  5. using namespace std;
  6. int z,z1,l,l1,h,h1,m,m1,cerinta,t,z2,l2,h2=1,m2,tarifora;
  7. ifstream fin("parcare.in");
  8. ofstream fout("parcare.out");
  9. int main()
  10. {
  11. fin>>z>>l>>h>>m;
  12. fin>>z1>>l1>>h1>>m1;
  13. fin>>t>>cerinta;
  14. if(cerinta==1)
  15. {
  16. // DACA LUNILE SUNT DIFERITE :
  17. // NU CRED CA AR TREBUI SA MODIFICAM Z UL
  18. // CE AR FI DACA AM FACE IN CAZUL ASTA DIF DINTRE 31/30/28 SI Z1 apoi adaugam z1 ????????
  19. if(l1!=l)
  20. {
  21. if (l==1) z2=31-z+z1;
  22. else if(l==2)z2=28-z+z1;
  23. else if(l==3)z2=31-z+z1;
  24. else if(l==4)z2=30-z+z1;
  25. else if(l==5)z2=31-z+z1;
  26. else if(l==6)z2=30-z+z1;
  27. else if(l==7)z2=31-z+z1;
  28. else if(l==8)z2=31-z+z1;
  29. else if(l==9)z2=30-z+z1;
  30. else if(l==10)z2=31-z+z1;
  31. else if(l==11)z2=30-z+z1;
  32. else if(l==12)z2=31-z+z1;
  33. h2=z2*24+h1-h;
  34. m2=(m1-m)+h2*60;
  35. fout << m2;
  36. return 0;
  37.  
  38. }
  39. else
  40. {
  41. z2=z1-z;
  42. if(z1==z)
  43. {
  44. h2=h1-h;
  45. m2=(m1-m)+h2*60;
  46. fout << m2;
  47. return 0;
  48. }
  49.  
  50. else
  51. {
  52. h2=(z1-z)*24+h1-h;
  53. m2=(m1-m)+h2*60;
  54. fout << m2;
  55. return 0;
  56. }
  57. }
  58. }
  59. else if(cerinta==2){
  60. if(l1!=l)
  61. {
  62. if (l==1) z2=31-z+z1;
  63. else if(l==2)z2=28-z+z1;
  64. else if(l==3)z2=31-z+z1;
  65. else if(l==4)z2=30-z+z1;
  66. else if(l==5)z2=31-z+z1;
  67. else if(l==6)z2=30-z+z1;
  68. else if(l==7)z2=31-z+z1;
  69. else if(l==8)z2=31-z+z1;
  70. else if(l==9)z2=30-z+z1;
  71. else if(l==10)z2=31-z+z1;
  72. else if(l==11)z2=30-z+z1;
  73. else if(l==12)z2=31-z+z1;
  74. h2=z2*24+h1-h;
  75. m2=(m1-m)+h2*60;
  76.  
  77.  
  78. }
  79. else
  80. {
  81. z2=z1-z;
  82. if(z1==z)
  83. {
  84. h2=h1-h;
  85. m2=(m1-m)+h2*60;
  86.  
  87. }
  88.  
  89. else
  90. {
  91. h2=(z1-z)*24+h1-h;
  92. m2=(m1-m)+h2*60;
  93.  
  94. }
  95. }
  96. if(m2%60==0){
  97. tarifora=t*(m2/60);
  98. }
  99. else if(m2<=15){
  100. tarifora=0;
  101. }
  102.  
  103. else tarifora=t*(m2/60+1);
  104. fout << tarifora;
  105.  
  106. }
  107.  
  108.  
  109. return 0;
  110.  
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement