📅  最后修改于: 2022-03-11 15:04:30.511000             🧑  作者: Mango
//Calculate Grains on a given square on a chessboard
const totalGrains = 2 ** 64 - 1;
const grainsOn = (input) => {
const grainCount = 2 ** (input - 1);
return grainCount;
};
console.log(`Grains on 6th square: ${grainsOn(6)}`);
console.log(`Total grains on the Chess Board: ${totalGrains}`);