H - Happy Birthday UN (18.10.2)

The Universidad Nacional de Colombia (UN) was created on September 22 of 1867, a Sunday. In 2017 the UN had its sesquicentenary, i.e. it was its 150th birthday. The sesquicentenary of the UN was on a Friday. As it is really important to know all the details corresponding to the date of this huge celebration for every year, we want to know which day of the week corresponds to a specific birthday of the Universidad Nacional de Colombia.

Remember that a year usually has 365 days, except for some years, called leaps-years which have 366 days. To know which year is a leap-year we have the following rule: Every year that is exactly divisible by four is a leap year, except for years that are exactly divisible by 100, but these centurial years are leap years if they are exactly divisible by 400. For example, the years 1700, 1800, and 1900 were not leap years, but the years 1600 and 2000 were.

Input

The input consists of a number n (0 ≤ n ≤ 10000)

Output

Output just one word corresponding to the day of the week at the n - th birthday of the UN.

Print the day on the following format (without quotation marks): 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' or 'Sunday'.

Examples

Input

0

Output

Sunday

Input

150

Output

Friday

题意:在1867年九月份星期天生日,问你,给出第N个生日给你,问你是星期几生日;

思路:若是闰年,则在下一年加二,否加一;

具体看代码:

#include <iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int main()
{

    int n;
    scanf("%d",&n);
    int p=1867;
    int ans=6;
    for(int i=p; i<=n+p; i++)
    {
        if((i%4==0&&i%100!=0)||(i%400==0))
            ans+=2;
        else ans+=1;
    }
    int t;
    t=ans%7;
    if(t==1)
        printf("Monday\n");
    else if(t==2)
        printf("Tuesday\n");
    else if(t==3)
        printf("Wednesday\n");
    else if(t==4)
        printf("Thursday\n");
    else if(t==5)
        printf("Friday\n");
    else if(t==6)
        printf("Saturday\n");
    else if(t==0)
        printf("Sunday\n");
    return 0;
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值