讨论 / 管理员请进
江一 2013-08-03 06:06:00
点我顶贴 收藏 删除
貌似数据是错的?

测试结果错误.错误结果为:147483648

正确结果应为:2147483648

测试结果错误.错误结果为:97152

正确结果应为:2097152

测试结果错误.错误结果为:62143

正确结果应为:262144

var

a , b : dword;

begin

readln ( a ); b := 0;

while a <> a and -a do begin

inc ( b , a and -a );

dec ( a , a and -a );

end;

if b<<1 < a then write ( b )

else writeln ( a - b );

end.

var

a , b : dword;

begin

readln ( a ); b := 1;

while b < a do b := b << 1;

if b-a > a-b>>1 then writeln ( a-b>>1 )

else writeln ( b-a );

end.

#1 wjltz@2011-03-11 16:47:00
回复 删除
同上

坑爹啊

#2 灰天飞雁@2011-03-11 19:18:00
回复 删除
[quote][url=/Discuss_Show.asp?DID=8577]原帖[/url]由 [i]江一[/i] 于 2011-3-11 20:20:00 发表

貌似数据是错的?

测试结果错误.错误结果为:147483648

正确结果应为:2147483648

测试结果错误.错误结果为:97152

正确结果应为:2097152

测试结果错误.错误结果为:62143

正确结果应为:262144

var

a , b : dword;

begin

readln ( a ); b := 0;

while a <> a and -a do begin

inc ( b , a and -a );

dec ( a , a and -a );

end;

if b<<1 < a then write ( b )

else writeln ( a - b );

end.

var

a , b : dword;

begin

readln ( a ); b := 1;

while b < a do b := b << 1;

if b-a > a-b>>1 then writeln ( a-b>>1 )

else writeln ( b-a );

end.

[/quote]

嗯...

#3 noip2012@2011-03-12 01:31:00
回复 删除
应该是错的
#4 897357142@2011-03-12 05:45:00
回复 删除
我也同意,我也这么错的
#5 随风吹月散@2011-03-19 06:35:00
回复 删除
应该是错了……那个大家怎么A的??
#6 1965131end@2011-03-19 06:53:00
回复 删除
WA 的
#7 Mine_ysd@2011-03-20 05:33:00
回复 删除
[quote][url=/Discuss_Show.asp?DID=8577]原帖[/url]由 [i]江一[/i] 于 2011-3-11 20:20:00 发表

貌似数据是错的?

测试结果错误.错误结果为:147483648

正确结果应为:2147483648

测试结果错误.错误结果为:97152

正确结果应为:2097152

测试结果错误.错误结果为:62143

正确结果应为:262144

var

a , b : dword;

begin

readln ( a ); b := 0;

while a <> a and -a do begin

inc ( b , a and -a );

dec ( a , a and -a );

end;

if b<<1 < a then write ( b )

else writeln ( a - b );

end.

var

a , b : dword;

begin

readln ( a ); b := 1;

while b < a do b := b << 1;

if b-a > a-b>>1 then writeln ( a-b>>1 )

else writeln ( b-a );

end.

[/quote]

错一摸一样......

#8 anhuizhangyu@2011-03-20 05:41:00
回复 删除
为什么呐?

害我WA了4次

#9 anhuizhangyu@2011-03-20 05:54:00
回复 删除
我过啦!

状态: Accepted

测评机: Xeost[5]

得分: 100分

提交日期: 2011-3-20 20:46:00

有效耗时: 640毫秒

测试结果1: 通过本测试点|有效耗时125ms

测试结果2: 通过本测试点|有效耗时47ms

测试结果3: 通过本测试点|有效耗时47ms

测试结果4: 通过本测试点|有效耗时46ms

测试结果5: 通过本测试点|有效耗时47ms

测试结果6: 通过本测试点|有效耗时47ms

测试结果7: 通过本测试点|有效耗时47ms

测试结果8: 通过本测试点|有效耗时47ms

测试结果9: 通过本测试点|有效耗时47ms

测试结果10: 通过本测试点|有效耗时47ms

测试结果11: 通过本测试点|有效耗时47ms

测试结果12: 通过本测试点|有效耗时46ms

#10 pig2000@2011-03-23 01:37:00
回复 删除
我也是这样错的,WA75

也许我们什么有情况没有考虑到?

状态: Unaccepted

测评机: Xeond[6]

得分: 75分

提交日期: 2011-3-23 16:31:00

有效耗时: 421毫秒

测试结果1: 通过本测试点|有效耗时47ms

测试结果2: 通过本测试点|有效耗时46ms

测试结果3: 测试结果错误.错误结果为:147483648

正确结果应为:2147483648

测试结果4: 通过本测试点|有效耗时47ms

测试结果5: 通过本测试点|有效耗时47ms

测试结果6: 测试结果错误.错误结果为:97152

正确结果应为:2097152

测试结果7: 测试结果错误.错误结果为:62143

正确结果应为:262144

测试结果8: 通过本测试点|有效耗时47ms

测试结果9: 通过本测试点|有效耗时47ms

测试结果10: 通过本测试点|有效耗时46ms

测试结果11: 通过本测试点|有效耗时47ms

测试结果12: 通过本测试点|有效耗时47ms

提交代码: view sourceprint?01.

#include<stdio.h>

int main()

{

int n,s=1,k;

scanf("%d",&n);

int k0=n;

while(1)

{

s=s*2;

k=abs(n-s);

if(k>k0)

break;

else k0=k;

}

printf("%d",k0);

return 0;

}

查看更多回复
提交回复