#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
#define MAX_N 1000
#ifndef DEB_VAL
#define DEB_VAL 0
#endif
#define DEB if(debug)
#define MP make_pair
#define PB push_back
#define FT first
#define SD second
int debug = DEB_VAL;
int x,d,h,m;
int res;
int main() {
scanf("%d %d %d %d", &x, &d, &h, &m);
d-=23;
if(x==5) {
if(d==4){
res=24*60+23*60+(24-h-1)*60+60-m;
}
if(d==5){
res=23*60+(24-h-1)*60+60-m;
}
if(d==6){
if(h<2) {
res=(2-h-1)*60+60-m+21*60;
} else {
res=(24-h-1)*60+60-m;
}
}
} else {
res=(x-d)*24*60;
res+=(24-h-1)*60+60-m;
}
printf("%d\n",res);
return 0;
}
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #include<cstdio> #include<algorithm> #include<vector> using namespace std; #define MAX_N 1000 #ifndef DEB_VAL #define DEB_VAL 0 #endif #define DEB if(debug) #define MP make_pair #define PB push_back #define FT first #define SD second int debug = DEB_VAL; int x,d,h,m; int res; int main() { scanf("%d %d %d %d", &x, &d, &h, &m); d-=23; if(x==5) { if(d==4){ res=24*60+23*60+(24-h-1)*60+60-m; } if(d==5){ res=23*60+(24-h-1)*60+60-m; } if(d==6){ if(h<2) { res=(2-h-1)*60+60-m+21*60; } else { res=(24-h-1)*60+60-m; } } } else { res=(x-d)*24*60; res+=(24-h-1)*60+60-m; } printf("%d\n",res); return 0; } |
English