View Code of Problem 8

#include<stdio.h>
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<map>
#include<vector>
#include<cstdbool>
using namespace std;
int yy[12][1] = { 31,28,31,30,31,30,31,31,30,31,30,31 };


int main()
{
	int n;
	string str;
	cin >> n;
	while (n--) {
		cin >> str;
		int shuzi = str[str.size() - 1] - '0';
		int sum = 0;
		for (int i = 0; i < 12; i++) {
			for (int y = 1; y <= yy[i][0]; y++) {
				if (fabs(((y % 10)+1)%10==shuzi)|| fabs(((y % 10) - 1) % 10 == shuzi)) {
					sum++;
				}
			}
		}
		cout << 365-sum << endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 8