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. pm2入门

    简介 PM2是node进程管理工具,可以利用它来简化很多node应用管理的繁琐任务,如性能监控.自动重启.负载均衡等,而且使用非常简单. 安装 全局安装,简直不能更简单. npm install -g ...

  2. 【Java】理解ClassNotFoundException与NoClassDefFoundError的区别

    一.概念上的认识 1)Exception与Error的区别 1.Exception的出现不会导致程序结束,用户程序可以捕获该异常 2.Error的出现会导致程序结束,用户程序无法捕获Error错误 2 ...

  3. Mysql使用语法总结

    查看数据库 show databases; 使用数据库 use honeypot; 查看数据表 show tables; 查看数据表结构 desc TABLEname; 修改数据表的某个字段的类型 a ...

  4. nginx源码安装与使用

    [root@localhost ~]# yum -y install pcre-devel zlib-devel openssl openssl-devel gcc* [root@localhost ...

  5. day33_8_15 并发编程4,线程池与协程,io模型

    一.线程池 线程池是一个处理线程任务的集合,他是可以接受一定量的线程任务,并创建线程,处理该任务,处理结束后不会立刻关闭池子,会继续等待提交的任务,也就是他们的进程/线程号不会改变. 当线程池中的任务 ...

  6. 【使用篇二】SpringBoot文件上传(5)

    一.单个文件上传 1. 在static目录下创建upload.html <!DOCTYPE html> <html> <head> <meta charset ...

  7. tf.tile() 用法介绍

    tile() 平铺之意,用于在同一维度上的复制 tile(        input,     #输入        multiples,  #同一维度上复制的次数        name=None  ...

  8. nexus php composer host 模式repo 试用

    前边有介绍以及运行过基于nexus proxy 模式的php composer(其中也有一些坑),以下是关于host 模式的 简单使用 环境准备 docker-compose 文件   version ...

  9. 【day03】php

    一.类型判别函数库 1.安装:类型判别函数库是PHPCORE的组成部分,不用安装 2.  (1)is_integer|is_int|is_long     描述:  检测变量是否是整数     格式: ...

  10. for循环包含多个双引号怎么办?windows

    for循环包含多个双引号怎么办?windows@echo offsetlocal EnableDelayedExpansionset "sed=%~sdp0sed"echo %se ...