View Code of Problem 8

#include<stdio.h>
int mon[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int main()
{
	char str[12]={0};
	int n,i,j,cnt,k,t;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		getchar();
		cnt=0;
		scanf("%s",str);
		t=str[7]-'0';
		for(j=0;j<12;j++)
		{
			for(k=1;k<=mon[j];k++)
			{
				if((t-1==(k%10))||(t+1==(k%10)))
					cnt++;
			}
		}
		printf("%d\n",(365-cnt));
	}
  return 0;
}

Double click to view unformatted code.


Back to problem 8