讨论 / 囧~这样都可以?!
L.Lawliet 2010-11-08 03:56:00
点我顶贴 收藏 删除
由于微机室刚刚做了还原 所以没有编译器 只好把合并果子copy过来,改了一下

没想到啊~~~

题目:橘子结配

状态: [color=green]Accepted[/color]

测评机: Xeond[6]

得分: 100分

提交日期: 2010-7-1 17:12:00

有效耗时: 359毫秒

测试结果1: [color=green]通过本测试点|有效耗时172ms [/color]

测试结果2: [color=green]通过本测试点|有效耗时46ms [/color]

测试结果3: [color=green]通过本测试点|有效耗时47ms [/color]

测试结果4: [color=green]通过本测试点|有效耗时47ms [/color]

测试结果5: [color=green]通过本测试点|有效耗时47ms [/color]

program guozi;

var a:array[0..10000]of longint;

min1,min11,min2,min22,i,n:longint;

sum:dword;

[color=red]fir:longint;//增加记录第一只橘子的变量(改动1)[/color]

begin

[color=red] fir:=-1;//初始化(改动2)[/color]

readln(n);

for i:=1 to n do read(a[i]);

while n<>1 do

begin

min1:=maxlongint;

min2:=maxlongint;

for i:=1 to n do

if a[i]<min1 then

begin

min11:=i;

min1:=a[i];

end;

[color=red]if fir=-1 then fir:=min1;//赋值(改动3)[/color]

for i:=1 to n do

if (a[i]<min2)and(i<>min11) then

begin

min22:=i;

min2:=a[i];

end;

a[min11]:=min1+min2;

sum:=sum+min1+min2;

a[min22]:=a[n];

dec(n);

end;

[color=red]writeln(sum+fir);//输出时加上(改动4)[/color]

[color=red]writeln('No');//输出判断结果 懒得判断了 有点cheat的味道。。(改动5)[/color]

end.

#1 luyao777@2010-11-08 03:56:00
回复 删除
我无语了

[color=pink]我无语了

查看更多回复
提交回复