当前位置:网站首页>20220607其他:两整数之和
20220607其他:两整数之和
2022-07-03 09:20:00 【丿SeeYouAgain】
题目描述:给你两个整数 a
和 b
,不使用 运算符 +
和 -
,计算并返回两整数之和。
编码实现:
public static int getSum(int a, int b) {
int bit = (a & b) << 1;
int result = a ^ b;
if (bit != 0){
return getSum(result,bit);
}
return result;
}
边栏推荐
- QT is a method of batch modifying the style of a certain type of control after naming the control
- Toolbutton property settings
- Pymssql controls SQL for Chinese queries
- LeetCode - 900. RLE 迭代器
- LeetCode - 919. Full binary tree inserter (array)
- Yocto technology sharing phase IV: customize and add software package support
- 20220603数学:Pow(x,n)
- CV learning notes - deep learning
- LeetCode - 1670 設計前中後隊列(設計 - 兩個雙端隊列)
- Simulate mouse click
猜你喜欢
1. Finite Markov Decision Process
Development of intelligent charging pile (I): overview of the overall design of the system
For new students, if you have no contact with single-chip microcomputer, it is recommended to get started with 51 single-chip microcomputer
One click generate traffic password (exaggerated advertisement title)
03 fastjason solves circular references
LeetCode - 1670 设计前中后队列(设计 - 两个双端队列)
2.Elment Ui 日期选择器 格式化问题
QT self drawing button with bubbles
3.1 Monte Carlo Methods & case study: Blackjack of on-Policy Evaluation
LeetCode - 715. Range 模块(TreeSet) *****
随机推荐
For new students, if you have no contact with single-chip microcomputer, it is recommended to get started with 51 single-chip microcomputer
QT detection card reader analog keyboard input
Modelcheckpoint auto save model
2021-10-28
On the problem of reference assignment to reference
CV learning notes - clustering
Opencv feature extraction sift
Of course, the most widely used 8-bit single chip microcomputer is also the single chip microcomputer that beginners are most easy to learn
4G module designed by charging pile obtains signal strength and quality
My 4G smart charging pile gateway design and development related articles
(1) What is a lambda expression
Opencv image rotation
STM32 running lantern experiment - library function version
2021-10-27
The new series of MCU also continues the two advantages of STM32 product family: low voltage and energy saving
[combinatorics] Introduction to Combinatorics (combinatorial idea 3: upper and lower bound approximation | upper and lower bound approximation example Remsey number)
Serial port programming
20220603数学:Pow(x,n)
QT self drawing button with bubbles
After clicking the Save button, you can only click it once