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