当前位置:网站首页>Week 16 OJ practice 1 calculates the day of the year
Week 16 OJ practice 1 calculates the day of the year
2022-07-26 17:31:00 【51CTO】
Problems and code :
Problem A: C Language exercises Calculate the day of the year
Description
Define a structure variable ( Including the year 、 month 、 Japan ). Write a function days, By the main function, the year 、 month 、 Day passed to function days, Calculate the day of the year and send the result back to the main function output .
Input
Specific date
Output
The first few days of that year
Sample Input
Sample Output
Running results :

Summary of knowledge points : You can define an array , First press February 28 Days counted , Finally, judge whether it is a leap month , if , Add a day , Remember to also judge that it is after February .
How to judge leap years
The rule that the leap year of the Gregorian calendar follows is :
A leap in four years , A hundred years without Leap , Four hundred years later .
A simple calculation method of leap year in Gregorian calendar ( A leap year is one of the following )
1. Can be 4 Divide without being 100 to be divisible by .
2. Can be 400 to be divisible by .
The learning : Once again, I encountered the problem about leap years , Leap year is judged by (n%4==0&&n%100!=0)||(n%400==0)
边栏推荐
- [basic course of flight control development 1] crazy shell · open source formation UAV GPIO (LED flight information light and signal light control)
- Heavy! Zeng Xuezhong was promoted to vice chairman and CEO of zhanrui, and Chu Qingren was appointed as co CEO!
- (24)Blender源码分析之顶层菜单显示代码分析
- 简述CUDA镜像构建
- Pytest(思维导图)
- [300 opencv routines] 240. Shi Tomas corner detection in opencv
- 37. [categories of overloaded operators]
- 重磅公布!ICML2022奖项:15篇杰出论文,复旦、厦大、上交大研究入选
- 【机器学习】Mean Shift原理及代码
- 03|实现 useReducer 和 useState
猜你喜欢

Review the past and know the new MySQL isolation level

Heavy announcement! Icml2022 Awards: 15 outstanding papers, selected by Fudan University, Xiamen University and Shanghai Jiaotong University

Tensor operation in pytoch
![[ctfshow-web]反序列化](/img/cd/b76e148adfc4d61049ab2cf429d4d7.png)
[ctfshow-web]反序列化

重磅公布!ICML2022奖项:15篇杰出论文,复旦、厦大、上交大研究入选

Summer Challenge openharmony greedy snake based on JS

得不偿失!博士骗领210万元、硕士骗领3万元人才补贴,全被判刑了!
![37. [categories of overloaded operators]](/img/67/b821270079589c53b9c38b0ca033ac.png)
37. [categories of overloaded operators]

How emqx 5.0 under the new architecture of mria+rlog realizes 100million mqtt connections

【机器学习】Mean Shift原理及代码
随机推荐
Execution process of select statement in MySQL
Idea Alibaba cloud multi module deployment
MySQL foundation - basic database operation
Implementing dropout with mxnet from zero sum
Implementing DDD based on ABP -- aggregation and aggregation root practice
注意 公安部发出旅游客运交通安全预警
Heavy! Zeng Xuezhong was promoted to vice chairman and CEO of zhanrui, and Chu Qingren was appointed as co CEO!
In the first half of the year, sales increased by 10% against the trend. You can always trust Volvo, which is persistent and safe
Take you a minute to learn about symmetric encryption and asymmetric encryption
How to ensure cache and database consistency
如何快速使用 ELisp 进行插件编写
[untitled]
regular expression
My meeting of OA project (meeting seating & submission for approval)
重磅公布!ICML2022奖项:15篇杰出论文,复旦、厦大、上交大研究入选
Quickly learn to configure local and network sources of yum, and learn to use yum
我们被一个 kong 的性能 bug 折腾了一个通宵
Avalanche subnets vs. polygon supernets of application chain
Mount NFS storage
SQL注入(思维导图)