当前位置:网站首页>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)
边栏推荐
- 重磅公布!ICML2022奖项:15篇杰出论文,复旦、厦大、上交大研究入选
- Method and voltage setting of exciting vibrating wire sensor with hand-held vibrating wire collector
- Use dired to move files quickly
- 浅谈云原生边缘计算框架演进
- [ctfshow-web]反序列化
- [Development Tutorial 9] crazy shell arm function mobile phone-i2c tutorial
- Concepts and differences of DQL, DML, DDL and DCL
- How does the data link layer transmit data
- Is it safe for Guosen Securities to open an account? How can I find the account manager
- 敏捷开发与DevOps的对比
猜你喜欢

How to ensure cache and database consistency

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

Recurrence of historical loopholes in ThinkPHP

In the first half of the year, sales increased by 10% against the trend. You can always trust Volvo, which is persistent and safe

How to connect tdengine with idea database tool?

【虚拟机数据恢复】意外断电导致XenServer虚拟机不可用,虚拟磁盘文件丢失的数据恢复案例
2.1.2 synchronization always fails

SCCM tips - improve the download speed of drivers and shorten the deployment time of the system when deploying the system

Why are test / development programmers who are better paid than me? Abandoned by the times

ASEMI整流桥KBPC2510,KBPC2510参数,KBPC2510规格书
随机推荐
Redis persistence - detailed analysis of RDB source code | nanny level analysis! The most complete network
The diagram of user login verification process is well written!
SCCM tips - improve the download speed of drivers and shorten the deployment time of the system when deploying the system
[ctfshow web] deserialization
Crazy God redis notes 02
Avalanche subnets vs. polygon supernets of application chain
2019 popularization group summary
Review the past and know the new MySQL isolation level
Batch normalization batch_ normalization
How does the data link layer transmit data
Stand aside with four and five rear cameras, LG or push the 16 rear camera mobile phone!
Quickly build a development platform for enterprise applications
leetcode:1206. 设计跳表【跳表板子】
2019普及组总结
Three misunderstandings of CRM implementation: lack of strategy, lack of identity, and technology first
API analysis of Taobao / tmall shipping address list and express delivery fees
[ctfshow-web]反序列化
Pytest (mind map)
Leetcode:1206. design jump table [jump table board]
Focus on 5g and AI! Next year, zhanrui will promote 7Nm 5g chips and NPU chips!