Submission
Status:
PPPPPPPPP----PP-PPPP
Subtask/Task Score:
75/100
Score: 75
User: polikanta
Problemset: ปฏิทินวันแม่
Language: cpp
Time: 0.005 second
Submitted On: 2026-08-15 19:23:33
#include <stdio.h>
int main() {
int m, d;
int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
scanf("%d", &m);
scanf("%d", &d);
int total = 0;
int answer;
if (m <= 8){
for (int i = m; i < 8; i++){
total += days[i];
}
total += 11;
answer = (d + total) % 7;
}
else{
for (int i = 8; i < m; i++){
total += days[i];
}
total = total - 11;
answer = 7 - ((d + total) % 7);
}
if (answer == 0) answer = 7;
printf("%d", answer);
return 0;
}