当前位置:网站首页>Blue Bridge Cup group B provincial preliminaries first question 2013 (Gauss Diary)
Blue Bridge Cup group B provincial preliminaries first question 2013 (Gauss Diary)
2022-07-06 02:25:00 【Professor】
Title : Gauss diary
Gauss, the great mathematician, has a good habit : Keep a diary anyway .
There is a difference in his diary , He never indicated the date of , It's a whole number instead of , such as :4210
Later people knew , That integer is the date , It says that day is the day after Gauss was born . Maybe it's a good habit , It reminds the master of : Another day passed , How much time can be wasted ?
Gauss was born in :1777 year 4 month 30 Japan .
In the diary of an important theorem discovered by Gauss, it says :5343, So we can figure out that it was :1791 year 12 month 15 Japan .
On the day Gauss got his doctorate, the diary read :8113
Please work out the date when Gauss got his doctorate .
The format for submitting the answer is :yyyy-mm-dd, for example :1980-03-21
Please follow the format strictly , Submit answers via browser .
Be careful : Just submit this date , Don't write anything else , such as : Explanatory text .
————————————————
#include<iostream>
using namespace std;
bool isLeapYear(int y)
{
return(y%4==0&&y%100!=0)||(y%400==0);// If it is a leap year, return 1, It's not a leap year return 0
}
int main()
{
int y=1777;
int m=4;
int d=30;
for(int i=0;i<8112;++i)// Remember to reduce the number of days 1, If the diary is 5343, Fill in here 5342, If the diary is 8113, Then fill in 8112
{
d++;
if(m==12&&d==32)// To 12 Month end initialization
{
y++;
m=1;
d=1;
continue;
}
if((m==1||m==3||m==5||m==7||m==8||m==10)&&d==32)// Initialize by the end of these months
{
m++;
d=1;
continue;
}
if((m==4||m==6||m==9|m==11)&&d==31)// Initialize by the end of these months
{
m++;
d=1;
continue;
}
if(m==2&&isLeapYear(y)&&d==30)// It's a leap year , return 1, Yes 29 God
{
m++;
d=1;
continue;
}
if(m==2&&!isLeapYear(y)&&d==29)// It's not a leap year return 0, Take instead 1, Yes 28 God
{
m++;
d=1;
continue;
}
}
cout<<y<<" "<<m<<" "<<d<<endl;
}
Here are some pictures , By year /4 Simply judge whether it is a leap year
边栏推荐
- 2020.02.11
- 构建库函数的雏形——参照野火的手册
- 有没有sqlcdc监控多张表 再关联后 sink到另外一张表的案例啊?全部在 mysql中操作
- Global and Chinese markets of nasal oxygen tubes 2022-2028: Research Report on technology, participants, trends, market size and share
- Executing two identical SQL statements in the same sqlsession will result in different total numbers
- 好用的 JS 脚本
- Jisuanke - t2063_ Missile interception
- Overview of spark RDD
- Minecraft 1.16.5 biochemical 8 module version 2.0 storybook + more guns
- UE4 - how to make a simple TPS role (I) - create a basic role
猜你喜欢
How does redis implement multiple zones?
Computer graduation design PHP part-time recruitment management system for College Students
Shell脚本更新存储过程到数据库
Ue4- how to make a simple TPS role (II) - realize the basic movement of the role
[width first search] Ji Suan Ke: Suan tou Jun goes home (BFS with conditions)
Spark accumulator
Formatting occurs twice when vs code is saved
Overview of spark RDD
高数_向量代数_单位向量_向量与坐标轴的夹角
爬虫(9) - Scrapy框架(1) | Scrapy 异步网络爬虫框架
随机推荐
Jisuanke - t2063_ Missile interception
更换gcc版本后,编译出现make[1]: cc: Command not found
模板_快速排序_双指针
Prepare for the autumn face-to-face test questions
Keyword static
Bigder:34/100 面试感觉挺好的,没有收到录取
550 permission denied occurs when FTP uploads files, which is not a user permission problem
I changed the driver to 5.1.35, but it is still the same error. I can succeed even now, but I will report this every time I do an SQL operation
更改对象属性的方法
Computer graduation design PHP part-time recruitment management system for College Students
Shell脚本更新存储过程到数据库
高数_向量代数_单位向量_向量与坐标轴的夹角
【无标题】数据库中一条查询SQL执行的过程
How to set an alias inside a bash shell script so that is it visible from the outside?
[robot hand eye calibration] eye in hand
MySQL (IV) - transactions
Campus second-hand transaction based on wechat applet
Global and Chinese markets of screw rotor pumps 2022-2028: Research Report on technology, participants, trends, market size and share
Black high-end responsive website dream weaving template (adaptive mobile terminal)
零基础自学STM32-野火——GPIO复习篇——使用绝对地址操作GPIO