#include <stdio.h> #include <string.h> #include <stdlib.h> int a[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int main() { int t; char n[20]; scanf("%d", &t); while (t--) { scanf("%s", n); int size = strlen(n); int k = n[size - 1] - '0'; int c = 0; for(int i = 1; i <= 12; i++) { for(int j = 1; j <= a[i]; j++) { int l = (j - 1) % 10; int r = (j + 1) % 10; if (l == k || r == k) { c++; } } } printf("%d\n", 365 - c); } } |
Double click to view unformatted code.