Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <math.h>
- #include <iomanip>
- using namespace std;
- int z,z1,l,l1,h,h1,m,m1,cerinta,t,z2,l2,h2=1,m2,tarifora;
- ifstream fin("parcare.in");
- ofstream fout("parcare.out");
- int main()
- {
- fin>>z>>l>>h>>m;
- fin>>z1>>l1>>h1>>m1;
- fin>>t>>cerinta;
- if(cerinta==1)
- {
- // DACA LUNILE SUNT DIFERITE :
- // NU CRED CA AR TREBUI SA MODIFICAM Z UL
- // CE AR FI DACA AM FACE IN CAZUL ASTA DIF DINTRE 31/30/28 SI Z1 apoi adaugam z1 ????????
- if(l1!=l)
- {
- if (l==1) z2=31-z+z1;
- else if(l==2)z2=28-z+z1;
- else if(l==3)z2=31-z+z1;
- else if(l==4)z2=30-z+z1;
- else if(l==5)z2=31-z+z1;
- else if(l==6)z2=30-z+z1;
- else if(l==7)z2=31-z+z1;
- else if(l==8)z2=31-z+z1;
- else if(l==9)z2=30-z+z1;
- else if(l==10)z2=31-z+z1;
- else if(l==11)z2=30-z+z1;
- else if(l==12)z2=31-z+z1;
- h2=z2*24+h1-h;
- m2=(m1-m)+h2*60;
- fout << m2;
- return 0;
- }
- else
- {
- z2=z1-z;
- if(z1==z)
- {
- h2=h1-h;
- m2=(m1-m)+h2*60;
- fout << m2;
- return 0;
- }
- else
- {
- h2=(z1-z)*24+h1-h;
- m2=(m1-m)+h2*60;
- fout << m2;
- return 0;
- }
- }
- }
- else if(cerinta==2){
- if(l1!=l)
- {
- if (l==1) z2=31-z+z1;
- else if(l==2)z2=28-z+z1;
- else if(l==3)z2=31-z+z1;
- else if(l==4)z2=30-z+z1;
- else if(l==5)z2=31-z+z1;
- else if(l==6)z2=30-z+z1;
- else if(l==7)z2=31-z+z1;
- else if(l==8)z2=31-z+z1;
- else if(l==9)z2=30-z+z1;
- else if(l==10)z2=31-z+z1;
- else if(l==11)z2=30-z+z1;
- else if(l==12)z2=31-z+z1;
- h2=z2*24+h1-h;
- m2=(m1-m)+h2*60;
- }
- else
- {
- z2=z1-z;
- if(z1==z)
- {
- h2=h1-h;
- m2=(m1-m)+h2*60;
- }
- else
- {
- h2=(z1-z)*24+h1-h;
- m2=(m1-m)+h2*60;
- }
- }
- if(m2%60==0){
- tarifora=t*(m2/60);
- }
- else if(m2<=15){
- tarifora=0;
- }
- else tarifora=t*(m2/60+1);
- fout << tarifora;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement