#include "iostream" #include "algorithm" #include "cstring" #include "vector" using namespace std; int a[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 }; int main() { int year; cin >> year; if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) a[2] = 29; else a[2] = 28; int k = year - 1998; int sum; int week = 4; for (int i = 1; i <= k; i++) { int y = 1998 + i; if ((y-1) % 4 == 0 && (y-1) % 100 != 0 || (y-1) % 400 == 0) /*减一的目的是当年的二月才为29天,所以当年的一月不受影响,影响的是下一年的*/ { sum = 366; } else { sum = 365; } week = week + sum % 7; if (week > 7) { week = week - 7; } } int ans = 0; for (int i = 1; i < 13; i++) { int w = week + (12 % 7); /*用12模是因为week已经包括第一天了*/ if (w > 7) w = w - 7; if (w == 5) ans++; week = week + a[i] % 7; if (week > 7) week = week - 7; } cout << ans << endl; return 0; }
0.0分
0 人评分