1716. 计算力扣银行的钱(1716. The calculation force deducts money from the bank)

class Solution {
    public int totalMoney(int n) {

            int sum = 0;
            int[] arr = {1,2,3,4,5,6,7};
            int month = n/7;
            int day = n%7;
            for(int i=0;i<month;i++){
                for(int j = 0;j<arr.length;j++){
                    sum +=arr[j]+i;
                }
            }

            for(int i=0;i<day;i++){
                sum+=arr[i]+month;
            }

            return sum;
    }
}
————————
class Solution {
    public int totalMoney(int n) {

            int sum = 0;
            int[] arr = {1,2,3,4,5,6,7};
            int month = n/7;
            int day = n%7;
            for(int i=0;i<month;i++){
                for(int j = 0;j<arr.length;j++){
                    sum +=arr[j]+i;
                }
            }

            for(int i=0;i<day;i++){
                sum+=arr[i]+month;
            }

            return sum;
    }
}