Cover image for leetcode每日一题 P1716 计算力扣银行的钱

leetcode每日一题 P1716 计算力扣银行的钱

字数 98
阅读
访客

时间轴

时间轴

2025-10-26

init

数学

题目:

非常简单的数学题

12345678910111213141516
struct Solution;impl Solution {    pub fn total_money(n: i32) -> i32 {        let week = n / 7;        let day = n % 7;        // 1,2   (1+2)*2/2        28 * week + 7 * (week - 1) * week / 2 + (week + 1 + week + day) * day / 2    }}fn main() {    println!("Hello, world!");}
评论加载中…