当前位置:网站首页>Print leap years between 1000 and 2000
Print leap years between 1000 and 2000
2022-07-24 04:37:00 【Hi hi】
Preface : Part of this article is quoted from Global information network
Catalog
1. The calculation rules of leap years
1. The calculation rules of leap years
After the precise calculation of astronomers , Summarize the following three calculation rules for leap years .
1、 Not a whole century : Can be 4 Divide without being 100 Divided by leap year .( Such as 2016 Year is leap year ,2100 Year is not a leap year )
2、 A hundred years : Can be 400 Divide without being 3200 Divided by leap years .( Such as 2000 Year is a leap year ,3200 Year is not a leap year )
3、 For years with large values : If you can divide this year 3200, And divisible 172800 It's a leap year . Such as 172800 Year is a leap year ,86400 Year is not a leap year .
The above rules are complicated , The simple rule we usually need to remember is : Can be 4 Divide without being 100 Divisible 、 Can be 400 All divisible years are leap years . After all , We can't live 3200 year . That is what we often call a leap every four years , A hundred years without Leap , Four hundred years later .
2. Code display
#include<stdio.h>
int main()
{
int i = 1000;
for (i; i >= 1000 && i <= 2000; i++)
if (i % 4 == 0 && i % 100 != 0 || i%400==0)
printf("%d ", i);
return 0;
}The following contents give a detailed introduction to leap years , You can have a look if you're interested :
3. Draw a picture
The math teacher said : The combination of number and shape is good . Let's use a picture to remember .
The above rule says 3 Number : Can be 4 Divisible number ( Write it down as A)、 Can be 100 Divisible number ( Write it down as B)、 Can be 400 Divisible number ( Write it down as C).
Can be 400 The number divisible must be 100 to be divisible by , Can be 100 The number divisible must be 4 to be divisible by . Can you figure this out ? If you remember 4 The multiple of is 4m,100 The multiple of can be expressed as 100m=4m*25,400 The multiple of can be expressed as 400m=100m*4.
Then the inclusion relationship in the figure below appears :

According to rules : Can be 4 Divide without being 100 Divisible 、 Can be 400 All divisible years are leap years . Then the year represented by the white shadow in the above figure is leap year .
Here, as long as we master the principle of leap year , Writing code is relatively simple
4. Why leap years occur
The time when the earth revolves around the sun is not accurate 365 God , Probably 3651/4 God , To be more precise
365.24219 God . We can't treat time that is not an integer as a year , Only approximate 365 Days as a year . such , polymeric 1/4 Day accumulation 4 One more day in the year , Leap year's 2 One more day in a month , To make up for the gap between astronomical years and calendar years .

The more troublesome thing is : It's not accurate to say that there is an extra day every four years , because 4*0.24219 Is not the same as 1 ah . The extra time every four years is not enough for one day , It's a little less every time , every 100 Year is one leap year less . So the saying that leap years occur every four years is wrong .
Every year, this 1/4 It can't be ignored . If we keep ignoring this every year 1/4 God ,100 After year , our “ Calendar year ” and “ Real year ” There's a difference between 25 God ! Every century we will be less than nearly 1 months ;700 After year , We have less 175 God . October becomes spring , December turns into summer . In this way, the solar terms are disordered .
边栏推荐
- Merge sort
- OWA dynamic password SMS authentication scheme solves the problem of outlook email two factor authentication
- Application scenarios and schemes of common mechanical equipment safety virtual simulation system
- How to get the signature file of Baidu Post Bar? Baidu Post Bar signature file setting and use method graphic introduction
- 可以脱离设据生效这些都是控化部署能力,而后引如
- E d-piece system is nfdavi oriented, reaching a high level for engineers
- Introduction to the application fields and functions of bank virtual human technology
- Which is better, Xiaomi current treasure or yu'e Bao? Detailed comparison and introduction of the differences between Xiaomi current Bao and Alibaba yu'e Bao
- Good performance and reliability. The parameter that initiates writing IIC co type code and is -4
- 最大公约数
猜你喜欢

Little black leetcode journey: 100 same trees

C语言经典习题之评委打分去掉最高最低求平均分

64 attention mechanism 10 chapters

C语言经典习题之猴子吃桃问题

Gau and ppm for image semantic segmentation

Airiot Q & A issue 5 | how to use low code business flow engine?

Threejs+shader drawing commonly used graphics

-Bash: wget: command not found

Go language series - synergy GMP introduction - with ByteDance interpolation

Up sampling method (deconvolution, interpolation, anti pooling)
随机推荐
IP second experiment mGRE OSPF
Threejs+shader drawing commonly used graphics
A hospital call system based on C language
How long has it been since you changed your cell phone?
数组力扣(持续更新)
C语言经典习题之评委打分去掉最高最低求平均分
致-.-- -..- -
[dish of learning notes, dog learning C] Dachang written test, is that it?
Array force buckle (continuously updated)
E d-piece system is nfdavi oriented, reaching a high level for engineers
Traversal of binary tree
Where is the difficulty in attracting investment in the park? Inventory of difficulties and difficulties in attracting investment in industrial parks
后 SQL 时代降临:EdgeDB 2.0 发布会预告
Merge sort
C language: selective sorting method
Export function called separately
12306 the most wonderful verification code in history: normal users can easily identify the ticket grabbing software and are rejected
C语言经典习题之编写一个程序,找出1000以内所有的完数。
Smart people's game improvement: Chapter 3 Lesson 3 example: the secret of prime
Smart contract: release an erc20 token