Leetcode 29. Divide Two Integers
https://leetcode.com/problems/divide-two-integers/
#include<math>
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;
}
};