May Day Holiday Time limit: 2 Seconds Memory Limit: 65536 KB
As a university advocating self-learning and Work-rest balance, Marjar University have so many days of rest, including Holi Days and weekends. Each weekend, which consists of Saturday and Sunday, was a rest time in the Marjar University.
The May Day, also known as International Workers "Day" or international Labour Day, falls on May 1st. In Marjar University, the could day holiday are a five-day vacation from could 1st to May 5th. Due to Saturday or Sunday is adjacent to the could day holiday, the continuous vacation could be as long as nine days in R Eality. For example, the could day in was Friday so the continuous vacation was only 5 days (could 1st to May 5th). And the Sunday so the continuous vacation are 6 days (April 30th to May 5th). In the, the Monday and vacation are 9 days (April 29th to May 7th). How excited!
Edward, the headmaster of Marjar University, is very curious how long is the continuous vacation containing could day in dif Ferent years. Can you help him?
Input
There is multiple test cases. The first line of input contains an integer indicating the number of the T test cases. For each test case, there is a integer y (1928 <= y <= 9999) in one line, indicating the year of Edward ' s Qu ery.
Output
For each case, print the number of the days of the continuous vacation in the.
Sample Input
32015 //s=42016//s =02017//s =1
Output
569 Test Instructions: Tell you that the Labor Day holiday begins in the days of the week for 1928-9,999 years of holiday in any year#include <bits/stdc++.h>using namespace Std;int run (int y) { if (y%4==0&&y%100!=0| | y%400==0) return 1; return 0;} int day (int y) { int sum = 0; int d=0; for (int i = 1928;i <y;i++) { sum+=365; if (run (i)) { sum++; } } sum+=120; if (run (y)) sum++; D= (d+sum)%7; return D;} int main () { int t; cin>>t; while (t--) { int y; cin>>y; int S=day (y); int ans = 5; if (s==1)//Friday ans = 9; else if (s==2| | s==0)//Monday and Saturday ans=6; cout<<ans<<endl; }}
12th Zhejiang province Game H Holiday