grains is should panic

This commit is contained in:
Rorik Star Platinum 2025-12-10 18:12:24 +03:00
parent 34eb2e1c4e
commit 9ea786eda5

View file

@ -1,7 +1,10 @@
pub fn square(s: u32) -> u64 {
if s == 0 || s > 64 {
panic!("Square must be between 1 and 64");
}
2_u64.pow(s - 1)
}
pub fn total() -> u64 {
(1..=64).map(|x| square(x)).sum()
(1..=64).map(square).sum()
}