max1:qword;
k:longint;
max:int64;
begin
readln(n,k); max:=1;
while k>0 do
begin
max1:=max1+max*(k mod 2);
max:=max*n;
k:=k shr 1;
end;
write(max1);
end.
为什么总是一点过不去,这程序应该没错呀????
测试结果2: 通过本测试点|有效耗时47ms
测试结果3: 通过本测试点|有效耗时47ms
测试结果4: 通过本测试点|有效耗时47ms
测试结果5: 通过本测试点|有效耗时46ms
测试结果6: 通过本测试点|有效耗时47ms
测试结果7: 通过本测试点|有效耗时63ms
测试结果8: 通过本测试点|有效耗时47ms
测试结果9: 测试结果错误.错误结果为:10609356940
正确结果应为:2019422348
测试结果10: 通过本测试点|有效耗时62ms
var
x,n,i,ss,k:longint;
s,sss:int64;
begin
readln(k,n);
s:=0;
ss:=1;
sss:=1;
if n mod 2 <>0 then
s:=s+1;
n:=n div 2;
while (n<>0)do
begin
x:=n mod 2;
if x <> 0 then
begin
for i:=1 to ss do
sss:=sss*k;
s:=s+sss;
sss:=1;
end;
inc(ss);
n:=n div 2;
end;
writeln(s);
end.
应该改成longint!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!