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