谁给科普以下chromecast如何播放youku,sohu还有nas的视频呀# PDA - 掌中宝
l*4
1 楼
leetcode上的divide integer题,小弟的code总是在2147483647, 1这个case上用时过
长,请高手帮忙挑挑bug 拜谢~
code如下:
int divide(int dend, int dor) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
long dividend=dend;
long divisor=dor;
if(dividend==0||divisor==0)
return 0;
int negate=1;
if(dividend<0){
dividend=-dividend;
negate=-negate;
}
if(divisor<0){
divisor=-divisor;
negate=-negate;
}
int count=0;
int addition=divisor;
while(divisor<=dividend){
divisor+=addition;
++count;
}
count*=negate;
return count;
}
长,请高手帮忙挑挑bug 拜谢~
code如下:
int divide(int dend, int dor) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
long dividend=dend;
long divisor=dor;
if(dividend==0||divisor==0)
return 0;
int negate=1;
if(dividend<0){
dividend=-dividend;
negate=-negate;
}
if(divisor<0){
divisor=-divisor;
negate=-negate;
}
int count=0;
int addition=divisor;
while(divisor<=dividend){
divisor+=addition;
++count;
}
count*=negate;
return count;
}