博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Leetcode 29. Divide Two Integers
阅读量:6984 次
发布时间:2019-06-27

本文共 371 字,大约阅读时间需要 1 分钟。

#include
class Solution {public: int divide(int dividend, int divisor) { long long int a=dividend,b=divisor; int flag=((dividend>0) ^ (divisor>0))? -1:1; a /= b; a=a>0?a:-a; a = a*flag; if(a==2147483648) return (1<<31)-1; else return a; }};

转载于:https://www.cnblogs.com/ximelon/p/10855032.html

你可能感兴趣的文章
RequestQueue
查看>>
Android TextView 属性设置
查看>>
html元素分类以及嵌套规则
查看>>
android dpi
查看>>
C语言的预处理、编译、汇编、链接
查看>>
魅族 C++ 微服务框架技术内幕揭秘
查看>>
flask 学习笔记 mvc ,sqlalchemy(insert,update)
查看>>
HTML基础(一)
查看>>
EGOImageView 解析
查看>>
我的友情链接
查看>>
1.解读REST和JAX-RS
查看>>
将RHEL7/centos7系统网卡名称eno16777736改为eth0
查看>>
Nginx域名跳转
查看>>
NTP时间服务器安装
查看>>
Thinkphp3.23 关联模型relation方法不存在解决方法
查看>>
bash脚本编程之一 条件判断及算术运算
查看>>
工作中非常逆天的shell命令
查看>>
我的友情链接
查看>>
[IOS]clang diagnostic、Wprotocol ..
查看>>
HTML4.01规范-HTML文档的顶层结构(3)
查看>>