leetcode每日一题第146天

class Solution {
public:
    int subtractProductAndSum(int n) {
        int mul = 1;
        int sum = 0;
        while(n)
        {
            mul *= n%10;
            sum += n%10;
            n/=10;
        }
        return mul-sum;

    }
};

相关推荐

  1. LeetCode 每日 Day 137-143

    2024-07-19 21:18:03       32 阅读
  2. LeetCode 每日 ---- 【1146.快照数组】

    2024-07-19 21:18:03       28 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-19 21:18:03       52 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-19 21:18:03       54 阅读
  3. 在Django里面运行非项目文件

    2024-07-19 21:18:03       45 阅读
  4. Python语言-面向对象

    2024-07-19 21:18:03       55 阅读

热门阅读

  1. 智能家居和智能家电有什么区别?

    2024-07-19 21:18:03       18 阅读
  2. Leetcode 9. 回文数

    2024-07-19 21:18:03       17 阅读
  3. final字段总结

    2024-07-19 21:18:03       12 阅读
  4. antd drawer extra中按钮点击事件获取子组件的数据

    2024-07-19 21:18:03       15 阅读
  5. HTML简介

    2024-07-19 21:18:03       18 阅读
  6. 2025秋招LLM大模型多模态面试题(五)- 位置编码

    2024-07-19 21:18:03       15 阅读
  7. 单例模式~

    2024-07-19 21:18:03       16 阅读
  8. python的mixin设计模式

    2024-07-19 21:18:03       17 阅读
  9. vue中v-if和v-for

    2024-07-19 21:18:03       16 阅读
  10. 计算机视觉10 总结

    2024-07-19 21:18:03       13 阅读