zoukankan      html  css  js  c++  java
  • H

    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
     1 #include <iostream>
     2 #include<stdio.h>
     3 #include<stdlib.h>
     4 using namespace std;
     5 int main()
     6 {
     7 
     8     int n;
     9     scanf("%d",&n);
    10     int p=1867;
    11     int ans=6;
    12     for(int i=p; i<=n+p; i++)
    13     {
    14         if((i%4==0&&i%100!=0)||(i%400==0))
    15             ans+=2;
    16         else ans+=1;
    17     }
    18     int t;
    19     t=ans%7;
    20     if(t==1)
    21         printf("Monday
    ");
    22     else if(t==2)
    23         printf("Tuesday
    ");
    24     else if(t==3)
    25         printf("Wednesday
    ");
    26     else if(t==4)
    27         printf("Thursday
    ");
    28     else if(t==5)
    29         printf("Friday
    ");
    30     else if(t==6)
    31         printf("Saturday
    ");
    32     else if(t==0)
    33         printf("Sunday
    ");
    34     return 0;
    35 }
  • 相关阅读:
    ajax traditional
    阿里云OSS NET SDK 引用示范程序
    js对象的两种写法
    BZOJ NOIP提高组十连测第一场
    ikbc 时光机 F87 Ctrl 失灵 解决办法
    【读书笔记】阅读的危险
    51nod 1118 机器人走方格 解题思路:动态规划 & 1119 机器人走方格 V2 解题思路:根据杨辉三角转化问题为组合数和求逆元问题
    【算法】求逆元模板
    【复习资料】软件工程之快速原型模型
    VirtualBox安装linux mint教程
  • 原文地址:https://www.cnblogs.com/kk4123366-n/p/9738883.html
Copyright © 2011-2022 走看看