Submission
Status:
PPPPPPPPPPP--PP-PPPP
Score: 85
User: Angonnyyy
Problemset: ปฏิทินวันแม่
Language: c
Time: 0.001 second
Submitted On: 2024-09-25 21:20:46
#include <stdio.h>
#include <math.h>
int main() {
int m, d;
scanf("%d", &m);
scanf("%d", &d);
switch (m) {
case 8:
break;
case 9:
d -= 3; break;
case 10:
d -= 5; break;
case 11:
d -= 8; break;
case 12:
d -= 10; break;
case 7:
d += 3; break;
case 6:
d += 5; break;
case 5:
d += 8; break;
case 4:
d += 10; break;
case 3:
d += 13; break;
case 2:
d += 13; break;
case 1:
d += 16; break;
}
d += 4; // Add 4 days to adjust for the given input day of the week
if (d % 7 == 0) {
d = 7; // If it's a multiple of 7, set it to Saturday
} else {
d = d % 7; // Otherwise, take the modulus to wrap around the week
}
printf("%d\n", d); // Print the final day of the week
return 0; // Added return statement
}