View Code of Problem 8

#include<stdio.h>
#include<string.h>
int main(){
	int n;
	int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	char str[30];
	scanf("%d",&n);
	while(n--){
		int count=0;
		scanf("%s",str);
		int len=strlen(str);
		int number=str[len-1]-'0';   //数字字符转化为数字 
		//printf("%d",number);
		for(int i=0;i<12;i++)
		  for(int j=1;j<=month[i];j++)
		      if((j-1)%10==number||(j+1)%10==number)           //禁止当日日期末尾数字的前后两位车牌尾号数字的小型载客汽车通过,比如31号禁止0和2的车通过 
			  count++; 
		printf("%d\n",365-count);
	} 
}

Double click to view unformatted code.


Back to problem 8