当前位置:网站首页>Li Kou daily question - day 30 -1281 Difference of sum of bit product of integer
Li Kou daily question - day 30 -1281 Difference of sum of bit product of integer
2022-06-29 06:37:00 【Chongyou research Sen】
2022.6.28 Did you brush the questions today ?
subject :
Give you an integer n, Please help calculate and return the integer 「 The product of your numbers 」 And 「 The sum of your numbers 」 Difference .
analysis :
Given an integer , Complete the multiplication of the product of each bit , And yours , Then use the product - and . for example
123
product :1*2*3=6
and :1+2+3=6
result = product - and =6-6=0
analysis :
class Solution {
public:
int subtractProductAndSum(int n) {
int mul = 1;
int sum = 0;
while (n != 0)
{
mul *= n % 10;
sum += n % 10;
n /= 10;
}
return mul - sum;
}
};边栏推荐
- jetson tx2
- flutter配置国内镜像,连接真机
- Venn diagram proportional and color shading with semi transparency
- MySQL add / delete / modify query SQL statement exercise yyds dry goods inventory
- Test Development - ten years of sharpening one sword (VII) interface test tool postman
- How does MySQL implement distributed locks?
- [deep learning] - maze task learning I (to realize the random movement of agents)
- Jenkins operation Chapter 6 mail server sending build results
- Introduction to Ceres Quartet
- 'only_ full_ group_ The influence of by'sql mode on group by and its treatment
猜你喜欢

Difference between URI and URL

用机器人教育创造新一代生产和服务工具

Fresnel diffraction with rectangular aperture based on MATLAB

Observer mode vs publish subscribe mode

Fault: ntfrs warning log for id13562

Establishing the development environment of esp8266

Principle of screen printing adjustment of EDA (cadence and AD) software

Rich material libraries make modeling easy and efficient for developers

Longest substring between two identical characters of leetcode simple question

关于DDNS
随机推荐
2022.02.14 - 239. A single element in an ordered array
Presto-Trial
Hyperledger Fabric 2. X custom smart contract
What are the uses of final?
What are the uses of wireless pressure collectors?
Establishing the development environment of esp8266
Design of leetcode simple problem goal parser
Hyperledger Fabric 2. X custom smart contract
2022.02.15 - 240. Lucky number in matrix
Chapter V online logic analyzer signaltap
Aging design guide for applets
Are there too many programmers in China at present?
Mongodb paging method
Why are keys unordered in golang map
多线程工具类 CompletableFuture
Ribbon service invocation and load balancing
Easy to understand TCP four waves (multi picture explanation)
百度小程序自动提交搜索
Go basic data types: characters and strings
Redistemplate handles hash integer type problem resolution