描述
在国外,每月的13号和每周的星期5都是不吉利的。特别是当13号那天恰好是星期5时,更不吉利。已知某年的一月一日是星期w,并且这一年一定不是闰年,求出这一年所有13号那天是星期5的月份,按从小到大的顺序输出月份数字。(w=1..7)
输入
输入有一行,即一月一日星期几(w)。(1 <= w <= 7)
输出
输出有一到多行,每行一个月份,表示该月的13日是星期五。
样例输入
7
样例输出
1 10
提示
1、3、5、7、8、10、12月各有31天
4、6、9、11月各有30天
2月有28天
#include<iostream> // 引入输入输出流库
#include<algorithm> // 引入算法库
#include<cstdio> // 引入C标准输入输出库
#include<cstring> // 引入C字符串库
using namespace std; // 使用标准命名空间
//1-31 2-59 3-90 4-120 5-151 6-181 7-212 8-243 9-273 10-304 11-334 12-365
int main(){ // 主函数
int n;
cin >> n;
if((13+n-1)%7==5){
cout<<'1'<<endl;
}
if((31+13+n-1)%7==5){
cout<<'2'<<endl;
}
if((59+13+n-1)%7==5){
cout<<'3'<<endl;
}
if((90+13+n-1)%7==5){
cout<<'4'<<endl;
}
if((120+13+n-1)%7==5){
cout<<'5'<<endl;
}
if((151+13+n-1)%7==5){
cout<<'6'<<endl;
}
if((181+13+n-1)%7==5){
cout<<'7'<<endl;
}
if((212+13+n-1)%7==5){
cout<<'8'<<endl;
}
if((243+13+n-1)%7==5){
cout<<'9'<<endl;
}
if((273+13+n-1)%7==5){
cout<<"10"<<endl;
}
if((304+13+n-1)%7==5){
cout<<"11"<<endl;
}
if((334+13+n-1)%7==5){
cout<<"12"<<endl;
}
}