40 lines
933 B
TypeScript
40 lines
933 B
TypeScript
|
function total(n: number) {
|
||
|
const tne = Math.floor((n + 1) / 2);
|
||
|
const neq = 4*tne + 4 * tne * (tne - 1);
|
||
|
const te = Math.floor((n) / 2);
|
||
|
const eq = 1 + 8 * te + 4 * te *(te - 1)
|
||
|
return {
|
||
|
neq,
|
||
|
eq
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const {
|
||
|
eq,
|
||
|
neq
|
||
|
} = total(202300 - 1);
|
||
|
|
||
|
console.log(eq, neq);
|
||
|
|
||
|
const fullfill_even = 7769;
|
||
|
const fullfill_odd = 7780;
|
||
|
|
||
|
const fullfills = fullfill_even * eq + fullfill_odd * neq;
|
||
|
console.log("inner",fullfills);
|
||
|
const corner = 5965 + 5947 + 5951+ 5933;
|
||
|
//
|
||
|
// const corner = 5866 + 5853 + 5859 + 5846;
|
||
|
console.log("corner",corner)
|
||
|
|
||
|
const big_edge = 6874+6871+6853+6860;
|
||
|
const small_edge = 1052+1059+1041+1038;
|
||
|
// const small_edge = ;
|
||
|
const edge = (202300 - 1) * big_edge + 202300 * small_edge;
|
||
|
|
||
|
console.log("edge",edge);
|
||
|
|
||
|
console.log("sum", fullfills + corner + edge)
|
||
|
// Too high: 636353717599990
|
||
|
// Too high: 636353676128237
|
||
|
// Too high: 636353671677626
|
||
|
// Not Correct: 636350593267107
|