Submission
Status:
--------------------
Score: 0
User: foldnut
Problemset: ปฏิทินวันแม่
Language: c
Time: 0.001 second
Submitted On: 2024-09-25 15:21:02
#include<stdio.h>
#include<string.h>
#include<math.h>
void main(){
int dayinyear[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
int month ,strday,r,sumdatebefore=0,motherday =193,dn;
scanf("%d",&month);
scanf("%d",&strday);
for(int i =0;i<month-1;i++){
sumdatebefore+=dayinyear[i];
}
if((motherday - sumdatebefore)<0){
r = sumdatebefore - motherday;
}
else{
r = motherday - sumdatebefore;
}
if((strday-r)%7<=0){
dn = (777777777776+strday-r)%7 +1;
}
else{
dn = (r-strday)%7;
}
printf("%d",dn);
}