题目编号:178-致命的珠宝 [查看该题]
状态: Unaccepted
测评机: Xeost[5]
得分: 40分
提交日期: 2008-8-4 13:33:00
有效耗时: 968毫秒
测试结果1: 通过本测试点|有效耗时187:ms
测试结果2: 测试结果错误.错误结果为:31
正确结果应为:15
测试结果3: 通过本测试点|有效耗时218:ms
测试结果4: 测试结果错误.错误结果为:31
正确结果应为:15
测试结果5: 测试结果错误.错误结果为:123
正确结果应为:31
测试结果6: 测试结果错误.错误结果为:123
正确结果应为:31
测试结果7: 测试结果错误.错误结果为:123
正确结果应为:31
测试结果8: 测试结果错误.错误结果为:31
正确结果应为:15
测试结果9: 通过本测试点|有效耗时282:ms
测试结果10: 通过本测试点|有效耗时281:ms
貌似测试数据好多雷同哦???
var
m,n,i,j,k,t,x,k1,k2,p:longint;
tot,tt,kk,kt:int64;
s,s1,s2:string;
a:array[0..1000] of string;
c:array[0..50] of longint;
begin
readln(n);
for i:=0 to 1000 do
a[i]:=’’;
for i:=1 to n do
begin
read(x);
while x<>0 do
begin
t:=x mod 7;
str(t,s);
a[i]:=a[i]+s;
x:=x div 7;
end;
end;
kt:=maxlongint;
for i:=1 to n-1 do
for j:=i+1 to n do
begin
s1:=’’;s2:=’’;
k1:=length(a[i]);s1:=a[i];
k2:=length(a[j]);s2:=a[j];
if k1>k2 then begin
for p:=k2 to k1-k2+1 do
s2:=s2+’0’;
end;
if k2>k1 then begin
for p:=k1 to k2-k1+1 do
s1:=s1+’0’;
end;
t:=0;
fillchar(c,sizeof(c),0);
for p:=1 to length(s1) do
if s1[p]<>s2[p] then begin t:=t+1; c[t]:=1; end
else begin t:=t+1; c[t]:=0; end;
tt:=c[1];kk:=1;
for p:=2 to t do
begin
kk:=kk*2;
tt:=tt+c[p]*kk;
end;
if abs(tt-123)<kt then begin tot:=tt;kt:=abs(tt-123); end;
end;
writeln(tot);
end.
大牛帮忙!!
谢谢!!