Divide_Two_Integers
来源:互联网 发布:美工穿什么衣服 编辑:程序博客网 时间:2024/06/10 06:09
题目描述:Divide two integers without using multiplication, division and mod operator.
(除两个数不使用乘除取余)
public class Divide_Two_Integers {public static void solve(int num1,int num2){int count=0;while(num1>=0&&num1>=num2){num1-=num2;count++;}System.out.println(count);}public static void main(String[] args){Scanner sc = new Scanner(System.in);int num1=sc.nextInt();int num2=sc.nextInt();solve(num1,num2);}}
阅读全文
1 0
- Divide_Two_Integers
- Divide_Two_Integers(低时间复杂度版)
- 数据结构(图遍历--广度优先遍历)
- unity网络连接的学习
- leetcode 582. Kill Process
- [bzoj4403]序列统计 Lucas定理
- 使用firewall-cmd命令配置防火墙
- Divide_Two_Integers
- 网易春招面试题--搬砖
- Activity之间跳转和参数传递
- Linux shell实现MySQL数据库简单查询&&MySQL多表联合查询
- 安卓SharedPreferences存储与读取
- 如何通俗地理解 Gradle?
- leetcode_162. Find Peak Element
- Android压缩安装包图片
- POJ 1277 Beer Land 笔记