View Code of Problem 8

#include<iostream>
#include<string>

using namespace std;

int main() {
	int t;
	cin >> t;
	while (t--) {
		int days = 0;
		string str;
		cin >> str;
		int endNum=str[7]-'0';
		if (endNum >= 2 && endNum <= 7) {
			cout << 365 - 12 * 6 << endl;;
		}
		else if(endNum == 1) {
			cout << 365 - 12 * 6 + 1 << endl;
		}
		else if (endNum == 0) {
			cout << 365 - 12 * 3 - 7 - 12 * 3 + 1 << endl;
		}
		else if (endNum == 8) {
			cout << 365 - 12 * 6 + 1 << endl;
		}
		else {
			cout << 365 - 12 * 4 - 12 - 11 << endl;
		}
	}

	return 0;
}

Double click to view unformatted code.


Back to problem 8