class Solution {
public int subtractProductAndSum(int n) {
int productResult = 1;
int sumResult = 0;
do {
int currentval = n % 10;
productResult *= currentval;
sumResult += currentval;
n /= 10;
}while(n > 0); return productResult - sumResult;
}
}

[Leetcode] 5279. Subtract the Product and Sum of Digits of an Integer的更多相关文章

  1. 【leetcode】1281. Subtract the Product and Sum of Digits of an Integer

    题目如下: Given an integer number n, return the difference between the product of its digits and the sum ...

  2. leetcode面试准备:Minimum Size Subarray Sum

    leetcode面试准备:Minimum Size Subarray Sum 1 题目 Given an array of n positive integers and a positive int ...

  3. [Leetcode 40]组合数和II Combination Sum II

    [题目] Given a collection of candidate numbers (candidates) and a target number (target), find all uni ...

  4. [Leetcode 39]组合数的和Combination Sum

    [题目] Given a set of candidate numbers (candidates) (without duplicates) and a target number (target) ...

  5. Product and Sum in Category Theory

    Even if you are not a functional programmer, the notion of product type should be familiar to you, e ...

  6. CodeForces 489C Given Length and Sum of Digits... (贪心)

    Given Length and Sum of Digits... 题目链接: http://acm.hust.edu.cn/vjudge/contest/121332#problem/F Descr ...

  7. Sum of Digits / Digital Root

    Sum of Digits / Digital Root In this kata, you must create a digital root function. A digital root i ...

  8. Maximum Sum of Digits(CodeForces 1060B)

    Description You are given a positive integer nn. Let S(x) be sum of digits in base 10 representation ...

  9. Codeforces Round #277.5 (Div. 2)C——Given Length and Sum of Digits...

    C. Given Length and Sum of Digits... time limit per test 1 second memory limit per test 256 megabyte ...

随机推荐

  1. python中优雅的杀死线程

    上一篇博客中,杀死线程采用的方法是在线程中抛出异常   https://www.cnblogs.com/lucky-heng/p/11986091.html, 这种方法是强制杀死线程,但是如果线程中涉 ...

  2. 十六、MySQL授权命令grant的使用方法

    MySQL 赋予用户权限命令的简单格式可概括为: grant 权限 on 数据库对象 to 用户 一.grant 普通数据用户,查询.插入.更新.删除 数据库中所有表数据的权利. grant sele ...

  3. 上云测试,这些关键点你get 到没有

    导读,先从云化说起,再谈谈云化形态下,除了常规的功能测试,云化的测试,还需要有几个必须要get到的硬核指标,最后在分别详解这些关键点硬核指标是什么,和如何测试呢.这是个值得深思的问题,希望所有测试人都 ...

  4. Rust中的迭代器

    和闭包一样,练代码 struct Counter { count: u32, } impl Counter { fn new() -> Counter { Counter {count: } } ...

  5. E06 【买衣服】Maybe you need a bigger size

    核心句型 Maybe you need a bigger size 也许您需要大一些的. 场景对话 A:Can I try this jacket on,please? 我能试试这件夹克吗? B:Su ...

  6. 201777010217-金云馨《面向对象程序设计Java》第四周总结学习

    2019面向对象程序设计(Java)第4周学习指导及要求 项目 内容 这个作业属于哪个课程 <任课教师博客主页链接>https://www.cnblogs.com/nwnu-daizh/ ...

  7. Python DataFrame 按条件筛选数据

    原始数据如下. 比如我想查看id等于11396的数据. pdata1[pdata1['id']==11396] 查看时间time小于25320的数据. pdata1[pdata1['time']< ...

  8. vue中使用kindeditor富文本编辑器2

    第一步,下载依赖 yarn add kindeditor 第二步,建立kindeditor.vue组件 <template> <div class="kindeditor& ...

  9. 阿里邮箱地址,smpt

    企业邮箱的POP3.SMTP.IMAP地址是什么? 企业邮箱POP.SMTP.IMAP地址列表如下: (阿里云邮箱web端通用访问地址:https://qiye.aliyun.com/),客户端推荐以 ...

  10. [BJOI2019]光线(DP)

    降智了…… 当你走头无路的时候就应该知道瞎搞一个DP: $p[i]$ 表示光射入第 $1$ 块玻璃时,从第 $i$ 块玻璃出去的光量. $q[i]$ 表示光射入第 $i$ 块玻璃时,从第 $i$ 块玻 ...