#include<iostream>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int x,d,h,m,d1;
int k=23,w=0;
cin>>x>>d>>h>>m;
d1=k+x;
if(x==5){
d1+=1;
}
if(x==5 && (d<29 || (d==29 && h<2))){
w-=60;
}
d=d1-d;
h=23-h;
m=59-m;
w+=d*24*60+h*60+m;
cout<<w+1;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #include<iostream> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int x,d,h,m,d1; int k=23,w=0; cin>>x>>d>>h>>m; d1=k+x; if(x==5){ d1+=1; } if(x==5 && (d<29 || (d==29 && h<2))){ w-=60; } d=d1-d; h=23-h; m=59-m; w+=d*24*60+h*60+m; cout<<w+1; } |
English