MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / intToDate

Function intToDate

code/other/dates.cpp:7–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5 3 * ((y + 4900 + (m - 14) / 12) / 100) / 4 +
6 d - 32075; }
7void intToDate(int jd, int &y, int &m, int &d) {
8 int x, n, i, j;
9 x = jd + 68569;
10 n = 4 * x / 146097;
11 x -= (146097 * n + 3) / 4;
12 i = (4000 * (x + 1)) / 1461001;
13 x -= 1461 * i / 4 - 31;
14 j = 80 * x / 2447;
15 d = x - 2447 * j / 80;
16 x = j / 11;
17 m = j + 2 - 12 * x;
18 y = 100 * (n - 49) + i + x; }
19// vim: cc=60 ts=2 sts=2 sw=2:

Callers 1

testFunction · 0.85

Calls

no outgoing calls

Tested by 1

testFunction · 0.68