#include <iostream>
int toOffset(int d, int h, int m) {
int o = d==30 || (d==29 && h>=3) ? 1 : 0;
return (d*24+h - o)*60 + m;
}
const int b[]={0, toOffset(25,0,0), toOffset(26,0,0), toOffset(27,0,0), toOffset(28,0,0), toOffset(30,0,0)};
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int x,d,h,m;
cin >> x >> d >> h >> m;
cout<<b[x]-toOffset(d,h,m)<<"\n";
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <iostream> int toOffset(int d, int h, int m) { int o = d==30 || (d==29 && h>=3) ? 1 : 0; return (d*24+h - o)*60 + m; } const int b[]={0, toOffset(25,0,0), toOffset(26,0,0), toOffset(27,0,0), toOffset(28,0,0), toOffset(30,0,0)}; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int x,d,h,m; cin >> x >> d >> h >> m; cout<<b[x]-toOffset(d,h,m)<<"\n"; return 0; } |
English