View Code of Problem 8

#include<bits/stdc++.h>

using namespace std;
int main(){
	int n;
	cin>>n;
	int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	while(n--){
		int num=0;
		string m;
		cin>>m;
		//int c = m[m.size()-1];
		int c = m[m.size()-1]-'0';
		//cout<<m[m.size()-1]<<endl<<c;
		for(int i=0;i<12;i++){
			for(int j=1;j<=a[i];j++){
				if(c==(j-1)%10 or c==(j+1)%10) num++;
			}
		}
		cout<<365-num<<endl;
	}
}

Double click to view unformatted code.


Back to problem 8