Submission
Status:
P-P-----------------
Score: 10
User: foldnut
Problemset: ปฏิทินวันแม่
Language: c
Time: 0.001 second
Submitted On: 2024-09-25 15:16:07
#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+=i;
}
if((motherday - sumdatebefore)<0){
r = sumdatebefore - motherday;
}
else{
r = motherday - sumdatebefore;
}
if((strday-r)%7<=0){
dn = (strday-r)%7 +7;
}
else{
dn = (strday-r)%7;
}
printf("%d",dn);
}