h*0
2 楼
大家有用这个offer吗? Gift card可以吗?
I*8
3 楼
这种情况,你说代码比较长,那就应该是复杂度的问题把。你把代码贴出来看看把
f*0
6 楼
每次都搞那么多GC,为了赚那么点苍蝇肉?
x*a
8 楼
outlet 可用否
w*h
12 楼
yes.
HOW CAN I REDEEM MY J.CREW GIFT CARD?
Gift Cards can be used at jcrew.com, on catalog phone orders or in any J.
Crew, J.Crew Factory or crewcuts store.
亮点“J.Crew Factory”
包子!
HOW CAN I REDEEM MY J.CREW GIFT CARD?
Gift Cards can be used at jcrew.com, on catalog phone orders or in any J.
Crew, J.Crew Factory or crewcuts store.
亮点“J.Crew Factory”
包子!
C*U
15 楼
不是科班出生 写代码 比较丑 别取笑我
int divide(int dividend, int divisor) {
int flag = 1;
unsigned int x;
unsigned int y;
unsigned int z;
unsigned int i = 0;
unsigned int count = 0;
int result = 0;
if(!divisor) {
cout << "could not be divided by 0" << endl;
return 0;
}
if(dividend < 0) {
flag = -1;
dividend = - dividend;
}
if(divisor < 0) {
if(flag < 0)
flag = 1;
else
flag = -1;
divisor = - divisor;
}
x = dividend;
y = divisor;
z = y;
while(x >= z) {
i++;
z = z << 1;
}
i--;
if(i < 0)
return 0;
for(int j = i; j >= 0; j--) {
z = y;
z = z << j;
count = 0;
while(x >= z) {
x -= z;
count++;
}
result += count << j;
}
if(flag > 0)
return result;
else
return - result;
}
【在 I*****8 的大作中提到】
: 这种情况,你说代码比较长,那就应该是复杂度的问题把。你把代码贴出来看看把
int divide(int dividend, int divisor) {
int flag = 1;
unsigned int x;
unsigned int y;
unsigned int z;
unsigned int i = 0;
unsigned int count = 0;
int result = 0;
if(!divisor) {
cout << "could not be divided by 0" << endl;
return 0;
}
if(dividend < 0) {
flag = -1;
dividend = - dividend;
}
if(divisor < 0) {
if(flag < 0)
flag = 1;
else
flag = -1;
divisor = - divisor;
}
x = dividend;
y = divisor;
z = y;
while(x >= z) {
i++;
z = z << 1;
}
i--;
if(i < 0)
return 0;
for(int j = i; j >= 0; j--) {
z = y;
z = z << j;
count = 0;
while(x >= z) {
x -= z;
count++;
}
result += count << j;
}
if(flag > 0)
return result;
else
return - result;
}
【在 I*****8 的大作中提到】
: 这种情况,你说代码比较长,那就应该是复杂度的问题把。你把代码贴出来看看把
s*g
16 楼
EGC也可以
d*g
18 楼
有人收这个egc吗?请pm我
C*U
25 楼
我把dividend和divisor存到x y里面都是unsigned int了
下面这个代码对了 通过leetcode的验证了 只不过写的很丑
把最小的数拿出来单独处理了
int divide(int dividend, int divisor) {
int flag = 1;
unsigned long int x;
unsigned long int y;
unsigned long int z;
unsigned int i = 0;
unsigned int count = 0;
int result = 0;
if(!divisor) {
cout << "could not be divided by 0" << endl;
return 0;
}
if(dividend == -2147483648) {
if(divisor > 0) {
dividend += divisor;
result = divide(dividend, divisor) - 1;
}
else {
dividend -= divisor;
result = divide(dividend, divisor) + 1;
}
return result;
}
if(dividend < 0) {
flag = -1;
x = - dividend;
}
else
x = dividend;
if(divisor < 0) {
if(flag < 0)
flag = 1;
else
flag = -1;
y = - divisor;
}
else
y = divisor;
z = y;
while(x >= z) {
i++;
z = z << 1;
}
i--;
if(i < 0)
return 0;
for(int j = i; j >= 0; j--) {
z = y;
z = z << j;
count = 0;
while(x >= z) {
x -= z;
count++;
}
result += count << j;
}
if(flag > 0)
return result;
else
return - result;
}
【在 q***y 的大作中提到】
: 你哪用unsigned int了?
: 你仔细看你的代码,还是用int存,所以溢出了
下面这个代码对了 通过leetcode的验证了 只不过写的很丑
把最小的数拿出来单独处理了
int divide(int dividend, int divisor) {
int flag = 1;
unsigned long int x;
unsigned long int y;
unsigned long int z;
unsigned int i = 0;
unsigned int count = 0;
int result = 0;
if(!divisor) {
cout << "could not be divided by 0" << endl;
return 0;
}
if(dividend == -2147483648) {
if(divisor > 0) {
dividend += divisor;
result = divide(dividend, divisor) - 1;
}
else {
dividend -= divisor;
result = divide(dividend, divisor) + 1;
}
return result;
}
if(dividend < 0) {
flag = -1;
x = - dividend;
}
else
x = dividend;
if(divisor < 0) {
if(flag < 0)
flag = 1;
else
flag = -1;
y = - divisor;
}
else
y = divisor;
z = y;
while(x >= z) {
i++;
z = z << 1;
}
i--;
if(i < 0)
return 0;
for(int j = i; j >= 0; j--) {
z = y;
z = z << j;
count = 0;
while(x >= z) {
x -= z;
count++;
}
result += count << j;
}
if(flag > 0)
return result;
else
return - result;
}
【在 q***y 的大作中提到】
: 你哪用unsigned int了?
: 你仔细看你的代码,还是用int存,所以溢出了
a*2
28 楼
term里面写了
Madewell branded merchandise, J.Crew Factory stores, jcrewfactory.com, and J
.Crew Canada purchases are excluded.
Madewell branded merchandise, J.Crew Factory stores, jcrewfactory.com, and J
.Crew Canada purchases are excluded.
h*3
29 楼
个人意见啊,你这程序还可以改进的合理些。
比如看是否是负数,其实用个bool就可以了,初始为false,每次遇见负数取反就可以
了。
如果divisor是1,直接返回dividend。。。
比如看是否是负数,其实用个bool就可以了,初始为false,每次遇见负数取反就可以
了。
如果divisor是1,直接返回dividend。。。
e*e
30 楼
请问能用主卡和副卡各搞一次吗?还是只能是一次?
thanks
thanks
d*a
33 楼
写了个递归的。
int divhelper(int a, int b)
{
if (a <= b)
return a / b;
int shift = 0;
while ((b << shift) <= a)
shift++;
return (1 << (shift - 1)) + divhelper(a - (b << (shift - 1)), b);
}
int div1(int a, int b)
{
assert(b != 0);
int sign;
if ((a >= 0 && b > 0) || (a < 0 && b < 0))
sign = 1;
else
sign = -1;
long long int c = abs(a);
long long int d = abs(b);
int result = divhelper(c , d);
return sign * result;
}
int divhelper(int a, int b)
{
if (a <= b)
return a / b;
int shift = 0;
while ((b << shift) <= a)
shift++;
return (1 << (shift - 1)) + divhelper(a - (b << (shift - 1)), b);
}
int div1(int a, int b)
{
assert(b != 0);
int sign;
if ((a >= 0 && b > 0) || (a < 0 && b < 0))
sign = 1;
else
sign = -1;
long long int c = abs(a);
long long int d = abs(b);
int result = divhelper(c , d);
return sign * result;
}
p*o
34 楼
What ?? Really ? I thought 主卡和副卡 have the same acct # ??
So in theory any offer can be used twice for same card ?
So in theory any offer can be used twice for same card ?
d*a
37 楼
if (a <= b)
return a / b;
改成
if (a < b)
return 0;
if (a == b)
return 1;
return a / b;
改成
if (a < b)
return 0;
if (a == b)
return 1;
相关阅读
Amex staples 能online买别家gc吗前两天有人说bluecasheveryday6%有后续消息么?一张rebate check last name 印错了,能存吗?3月飞马尔代夫,求推荐cash back好的信用卡急问~有关房产委托书办理怎么用serve付信用卡的bill啊?[合集] 【八卦系列1】British Airways 的血雨腥风 (转载)staples coupon: 15 off for 100。1/19 expire--2个包子identity被盗Alaska 里程要多久才能到账?飞得比较多用UA还是蓝宝石好?visa GC在Walmart可以直接买money order?chevron加油,莫名被扣了3次126块钱,请问如何取消后知后觉准备citi dividend, 2个问题假设信用记录很多年,而且大部分的卡都申完了的人。美国汽车还要每年交财产税?BOA travel credit card 点数换算规则及redeem相关问题收到 Ink Plus的邀请送7万点收到chase saving寄来的1099,连给的bonus都要上税citi 的油卡全部没有了