View Code of Problem 8

#define _CRT_SECURE_NO_DEPRECATE
#include <iostream>
#include<stdio.h>
using namespace std;
int main()
{
		int n;
		scanf("%d", &n);
		char str[100];
		int sum = 0;
		int day[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
		while (n--) {
			scanf("%s", str);
			
			int len = strlen(str);
			int k = str[len - 1] - '0';
			for (int i = 0; i < 12; i++) {
				for (int j = 1; j <= day[i]; j++) {
					if ((j + 1) % 10 == k || (j - 1) % 10 == k) {
						sum++;
					}
				}
			}
			std::cout << 365 - sum;
			sum = 0;

		}
}
/*
Main.cc: In function 'int main()':
Main.cc:15:24: error: 'strlen' was not declared in this scope
    int len = strlen(str);
                        ^
*/

Double click to view unformatted code.


Back to problem 8