日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Codeforces Good Bye 2015 A. New Year and Days 水题

發布時間:2023/12/10 编程问答 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Codeforces Good Bye 2015 A. New Year and Days 水题 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

A. New Year and Days

題目連接:

http://www.codeforces.com/contest/611/problem/A

Description

Today is Wednesday, the third day of the week. What's more interesting is that tomorrow is the last day of the year 2015.

Limak is a little polar bear. He enjoyed this year a lot. Now, he is so eager to the coming year 2016.

Limak wants to prove how responsible a bear he is. He is going to regularly save candies for the entire year 2016! He considers various saving plans. He can save one candy either on some fixed day of the week or on some fixed day of the month.

Limak chose one particular plan. He isn't sure how many candies he will save in the 2016 with his plan. Please, calculate it and tell him.

Input

The only line of the input is in one of the following two formats:

"x of week" where x (1?≤?x?≤?7) denotes the day of the week. The 1-st day is Monday and the 7-th one is Sunday.

"x of month" where x (1?≤?x?≤?31) denotes the day of the month.

Output

Print one integer — the number of candies Limak will save in the year 2016.

Sample Input

4 of week

Sample Output

52

Hint

題意:

給你兩種詢問,1.問你2016年中周x有多少天,2.問你2016年中x號一共有多少天。

題解:

數日歷。

代碼

#include<bits/stdc++.h> using namespace std;int C(int year,int month,int day) {if(month<3){year-=1;month+=12;}int c=(int)(year/100),y=year - 100*c;int w=(int)(c/4)-2*c+y+int(y/4)+(26*(month+1)/10)+day-1;w = (w%7+7)%7;return w; }int mon[13]={0,31,29,31,30,31,30,31,31,30,31,30,31}; char s1[10],s2[10],s3[10]; int main() {int x;scanf("%d%s%s",&x,s1,s3);if(s3[0]=='m'){int ans = 0;for(int i=1;i<=12;i++)if(mon[i]>=x)ans++;cout<<ans<<endl;}else{if(x==5||x==6)return puts("53");return puts("52");} }

轉載于:https://www.cnblogs.com/qscqesze/p/5091148.html

總結

以上是生活随笔為你收集整理的Codeforces Good Bye 2015 A. New Year and Days 水题的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。