View Code of Problem 8

#include <stdio.h>
int main(){
	int T;
	scanf("%d", &T);
	while(T>0){
		char str[8];
		scanf("%s", str);
		int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};
		int cnt = 365;
		for(int i =0;i<12;i++){
			for(int j=1;j<=month[i];j++){
				    int a = (j+ 1)%10 ;
				    int b = (j- 1)%10 ;
					
			    	int c = str[7] - '0';
			    	if(a == c || b ==c)
						cnt --;			
				}
		}
		printf("%d\n",cnt);
		T--;
	}
}

Double click to view unformatted code.


Back to problem 8