Result: Accepted
Time: 6ms
Memory: 1092kB
#include<stdio.h>
int main()
{
int a1, a2, b1, b2, c1, c2, total = 0;
scanf("%d%d%d", &a1, &b1, &c1);
scanf("%d%d%d", &a2, &b2, &c2);
if (a2 - a1 == 1)
{
total = (23 - b1) * 60 * 60 + (60 - c1) * 60 + b2 * 60 * 60 + c2 * 60;
if (total <= 86400)
{
printf("Y e s\n");
}
else
{
printf("N o\n");
}
}
else if (a2 == a1)
{
printf("Y e s\n");
}
else if (a1 == 7 && a2 == 1)
{
total = (23 - b1) * 60 * 60 + (60 - c1) * 60 + b2 * 60 * 60 + c2 * 60;
if (total <= 86400)
{
printf("Y e s\n");
}
else
{
printf("N o\n");
}
}
else
{
printf("N o\n");
}
return 0;
}