535 条题解
-
0ys339368412 LV 8 @ 2009-06-10 21:29:06
编译通过...
├ 测试数据 01:答案正确... 244ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 9ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 447ms
├ 测试数据 08:答案正确... 509ms
├ 测试数据 09:答案正确... 447ms
├ 测试数据 10:答案正确... 353ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:2009ms
今年耗时2009ms
晕.. -
02009-06-09 20:49:49@
编译通过...
├ 测试数据 01:答案正确... 415ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 72ms
├ 测试数据 07:答案正确... 290ms
├ 测试数据 08:答案正确... 446ms
├ 测试数据 09:答案正确... 274ms
├ 测试数据 10:答案正确... 368ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:1865ms
一开始全用快排结果超了..
只用一次快排艰难通过..var i,n,s,j,k,p:longint;
a:array[1..30000] of longint;procedure qsort(l,r:longint);
var i,j,m,t:longint;
begin
i:=l; j:=r; m:=a[(i+j) div 2];
repeat
while a[i]m do dec(j);
if ij;
if l -
02009-05-27 23:11:47@
有没有不排序的能过?
-
02009-05-17 10:48:23@
program fruit;
uses dos;
var a:array[1..20000] of longint;
n,n1,ans,min1,min2:longint;
f:text;
t1,t2,t3,t4,t5,t6,t7,t8:word;
t:double;
procedure init;
var i:longint;
begin
gettime(t1,t2,t3,t4);
assign(f,'fruit.in');reset(f);
readln(f,n);
for i:=1 to n do read(f,a[i]);
close(f);
end;
procedure qsort(l,r:longint);
var i,j,x,temp:longint;
begin
i:=l;j:=r;x:=a[random(r-l+1)+l];
repeat
while a[i]x do j:=j-1;
if ij;
if l if iend;
function deletemin:longint;
var i,j,temp:longint;
begin
deletemin:=a[1];
a[1]:=a[n1];
n1:=n1-1;
i:=1;
while i1) and (a[i] begin
temp:=a[i];a[i]:=a[i div 2];a[i div 2]:=temp;
i:=i div 2;
end;
end;
procedure main;
var i,j,k1,k2:longint;
begin
n1:=n;
for i:=1 to n-1 do
begin
min1:=deletemin;
min2:=deletemin;
insert(min1+min2);
ans:=ans+min1+min2;
end;
assign(f,'fruit.out');rewrite(f);
writeln(f,ans);
close(f);
gettime(t5,t6,t7,t8);
t:=((t5-t1)*60+(t6-t2))*60+(t7-t3)+(t8-t4)/100;
writeln(t:0:3);
end;
begin
init;
qsort(1,n);
main;
end. -
02009-05-12 11:02:17@
编译通过...
├ 测试数据 01:答案正确... 181ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 88ms
├ 测试数据 08:答案正确... 181ms
├ 测试数据 09:答案正确... 88ms
├ 测试数据 10:答案正确... 181ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:719ms快排+链表,觉得程序太烂了!!!!!!
type www=record
data:longint;
l,r:integer;
end;
var i,j,k,n,p,q,max,next,head,s,t,x,total:longword;
a:array[1..10000] of longint;
d:array[1..50000,1..2] of integer;
f:array[0..10000] of www;
begin
readln(n);
for i:=1 to n do read(a[i]);
s:=0;
t:=1;
d[1,1]:=1;
d[1,2]:=n;
repeat
inc(s);
x:=a[(d+d) div 2];
a[(d+d) div 2]:=a[d];
a[d]:=x;
i:=d;
j:=d;
while i -
02009-05-10 16:46:48@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:内存溢出...
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Unaccepted 有效得分:90 有效耗时:0ms
var n,i,j,y,s:longint;
a:array [0..100000000] of integer;
begin
readln(n);
for i:=1 to n do
begin
read(j);
inc(a[j]);
end;
for i:=1 to n-1 do
begin
y:=0;
while a[j]=0 do inc(j);
inc(y,j); dec(a[j]);
while a[j]=0 do inc(j);
inc(y,j); dec(a[j]);
inc(a[y]); inc(s,y);
end;
writeln(s);
end.请大牛指点。
采用了计排。
不知为什么,应该说所用内存都是一样的,为什么其他点过了,一个点超内存? -
02009-05-10 15:51:09@
壓匯倖惚坩戦・謹謹厮将繍侭嗤議惚徨嬉阻和栖・遇拝梓惚徨議音揖嶽窃蛍撹阻音揖議均。謹謹畳協委侭嗤議惚徨栽撹匯均。
耽匯肝栽旺・謹謹辛參委曾均惚徨栽旺欺匯軟・・債議悶薦吉噐曾均惚徨議嶷楚岻才。辛參心竃・侭嗤議惚徨将狛n-1肝栽旺岻朔・祥峪複和匯均阻。謹謹壓栽旺惚徨扮悳慌・債議悶薦吉噐耽肝栽旺侭債悶薦岻才。
咀葎珊勣雑寄薦賑委宸乂惚徨衣指社・侭參謹謹壓栽旺惚徨扮勣勝辛嬬仇准福悶薦。邪協耽倖惚徨嶷楚脅葎1・旺拝厮岑惚徨議嶽窃方才耽嶽惚徨議方朕・低議販暦頁譜柴竃栽旺議肝會圭宛・聞謹謹債継議悶薦恷富・旺補竃宸倖恷弌議悶薦債継峙。
箭泌嗤3嶽惚徨・方朕卆肝葎1・2・9。辛參枠繍1、2均栽旺・仟均方朕葎3・債継悶薦葎3。俊彭・繍仟均嚥圻枠議及眉均栽旺・嗽誼欺仟議均・方朕葎12・債継悶薦葎12。侭參謹謹悳慌債継悶薦=3+12=15。辛參屬苧15葎恷弌議悶薦債継峙。 -
02009-05-07 22:12:55@
先进行快排,输入数组a求和后放入队列b,通过判断a前两项与队列b的前两项的大小,只有三种情况:a[i]+a, a[i]+b[j], b[j]+b[j+1];
注意如果存在大量重复数字时,可能出现a数组扫描完后,剩大量队列b种的元素,只要逐一相加后放在队列后即可.
最后当队列只剩一个元素时停止.
为了判断方便可以,将a数组队尾写入一个无穷大. -
02009-05-02 11:43:08@
MyProger\Prog61977.cpp:5: error: stray '\227' in program
MyProger\Prog61977.cpp:5: error: stray '\128' in program
MyProger\Prog61977.cpp:5: error: stray '\128' in program
MyProger\Prog61977.cpp:5: error: stray '\227' in program
MyProger\Prog61977.cpp:5: error: stray '\128' in program
MyProger\Prog61977.cpp:5: error: stray '\128' in program
MyProger\Prog61977.cpp:6: error: stray '\227' in program
MyProger\Prog61977.cpp:6: error: stray '\128' in program
MyProger\Prog61977.cpp:6: error: stray '\128' in program
MyProger\Prog61977.cpp:6: error: stray '\227' in program
MyProger\Prog61977.cpp:6: error: stray '\128' in program
MyProger\Prog61977.cpp:6: error: stray '\128' in program
MyProger\Prog61977.cpp:7: error: stray '\227' in program
MyProger\Prog61977.cpp:7: error: stray '\128' in program
MyProger\Prog61977.cpp:7: error: stray '\128' in program
MyProger\Prog61977.cpp:7: error: stray '\227' in program
MyProger\Prog61977.cpp:7: error: stray '\128' in program
MyProger\Prog61977.cpp:7: error: stray '\128' in program
MyProger\Prog61977.cpp:8: error: stray '\227' in program
MyProger\Prog61977.cpp:8: error: stray '\128' in program
MyProger\Prog61977.cpp:8: error: stray '\128' in program
MyProger\Prog61977.cpp:8: error: stray '\227' in program
MyProger\Prog61977.cpp:8: error: stray '\128' in program
MyProger\Prog61977.cpp:8: error: stray '\128' in program
MyProger\Prog61977.cpp:9: error: stray '\227' in program
MyProger\Prog61977.cpp:9: error: stray '\128' in program
MyProger\Prog61977.cpp:9: error: stray '\128' in program
MyProger\Prog61977.cpp:9: error: stray '\227' in program
MyProger\Prog61977.cpp:9: error: stray '\128' in program
MyProger\Prog61977.cpp:9: error: stray '\128' in program
MyProger\Prog61977.cpp:10: error: stray '\227' in program
MyProger\Prog61977.cpp:10: error: stray '\128' in program
MyProger\Prog61977.cpp:10: error: stray '\128' in program
MyProger\Prog61977.cpp:10: error: stray '\227' in program
MyProger\Prog61977.cpp:10: error: stray '\128' in program
MyProger\Prog61977.cpp:10: error: stray '\128' in program
MyProger\Prog61977.cpp:10: error: stray '\227' in program
MyProger\Prog61977.cpp:10: error: stray '\128' in program
MyProger\Prog61977.cpp:10: error: stray '\128' in program
MyProger\Prog61977.cpp:10: error: stray '\227' in program
MyProger\Prog61977.cpp:10: error: stray '\128' in program
MyProger\Prog61977.cpp:10: error: stray '\128' in program
MyProger\Prog61977.cpp:10: error: stray '\227' in program
MyProger\Prog61977.cpp:10: error: stray '\128' in program
MyProger\Prog61977.cpp:10: error: stray '\128' in program
MyProger\Prog61977.cpp:10: error: stray '\227' in program
MyProger\Prog61977.cpp:10: error: stray '\128' in program
MyProger\Prog61977.cpp:10: error: stray '\128' in program
MyProger\Prog61977.cpp:11: error: stray '\227' in program
MyProger\Prog61977.cpp:11: error: stray '\128' in program
MyProger\Prog61977.cpp:11: error: stray '\128' in program
MyProger\Prog61977.cpp:11: error: stray '\227' in program
MyProger\Prog61977.cpp:11: error: stray '\128' in program
MyProger\Prog61977.cpp:11: error: stray '\128' in program
MyProger\Prog61977.cpp:11: error: stray '\227' in program
MyProger\Prog61977.cpp:11: error: stray '\128' in program
MyProger\Prog61977.cpp:11: error: stray '\128' in program
MyProger\Prog61977.cpp:11: error: stray '\227' in program
MyProger\Prog61977.cpp:11: error: stray '\128' in program
MyProger\Prog61977.cpp:11: error: stray '\128' in program
MyProger\Prog61977.cpp:11: error: stray '\227' in program
MyProger\Prog61977.cpp:11: error: stray '\128' in program
MyProger\Prog61977.cpp:11: error: stray '\128' in program
MyProger\Prog61977.cpp:11: error: stray '\227' in program
MyProger\Prog61977.cpp:11: error: stray '\128' in program
MyProger\Prog61977.cpp:11: error: stray '\128' in program
MyProger\Prog61977.cpp:12: error: stray '\227' in program
MyProger\Prog61977.cpp:12: error: stray '\128' in program
MyProger\Prog61977.cpp:12: error: stray '\128' in program
MyProger\Prog61977.cpp:12: error: stray '\227' in program
MyProger\Prog61977.cpp:12: error: stray '\128' in program
MyProger\Prog61977.cpp:12: error: stray '\128' in program
MyProger\Prog61977.cpp:13: error: stray '\227' in program
MyProger\Prog61977.cpp:13: error: stray '\128' in program
MyProger\Prog61977.cpp:13: error: stray '\128' in program
MyProger\Prog61977.cpp:13: error: stray '\227' in program
MyProger\Prog61977.cpp:13: error: stray '\128' in program
MyProger\Prog61977.cpp:13: error: stray '\128' in program
MyProger\Prog61977.cpp:14: error: stray '\227' in program
MyProger\Prog61977.cpp:14: error: stray '\128' in program
MyProger\Prog61977.cpp:14: error: stray '\128' in program
MyProger\Prog61977.cpp:14: error: stray '\227' in program
MyProger\Prog61977.cpp:14: error: stray '\128' in program
MyProger\Prog61977.cpp:14: error: stray '\128' in program
MyProger\Prog61977.cpp:15: error: stray '\227' in program
MyProger\Prog61977.cpp:15: error: stray '\128' in program
MyProger\Prog61977.cpp:15: error: stray '\128' in program
MyProger\Prog61977.cpp:15: error: stray '\227' in program
MyProger\Prog61977.cpp:15: error: stray '\128' in program
MyProger\Prog61977.cpp:15: error: stray '\128' in program
MyProger\Prog61977.cpp:15: error: stray '\227' in program
MyProger\Prog61977.cpp:15: error: stray '\128' in program
MyProger\Prog61977.cpp:15: error: stray '\128' in program
MyProger\Prog61977.cpp:15: error: stray '\227' in program
MyProger\Prog61977.cpp:15: error: stray '\128' in program
MyProger\Prog61977.cpp:15: error: stray '\128' in program
MyProger\Prog61977.cpp:15: error: stray '\227' in program
MyProger\Prog61977.cpp:15: error: stray '\128' in program
MyProger\Prog61977.cpp:15: error: stray '\128' in program
MyProger\Prog61977.cpp:15: error: stray '\227' in program
MyProger\Prog61977.cpp:15: error: stray '\128' in program
MyProger\Prog61977.cpp:15: error: stray '\128' in program
MyProger\Prog61977.cpp:16: error: stray '\227' in program
MyProger\Prog61977.cpp:16: error: stray '\128' in program
MyProger\Prog61977.cpp:16: error: stray '\128' in program
MyProger\Prog61977.cpp:16: error: stray '\227' in program
MyProger\Prog61977.cpp:16: error: stray '\128' in program
MyProger\Prog61977.cpp:16: error: stray '\128' in program
MyProger\Prog61977.cpp:16: error: stray '\227' in program
MyProger\Prog61977.cpp:16: error: stray '\128' in program
MyProger\Prog61977.cpp:16: error: stray '\128' in program
MyProger\Prog61977.cpp:16: error: stray '\227' in program
MyProger\Prog61977.cpp:16: error: stray '\128' in program
MyProger\Prog61977.cpp:16: error: stray '\128' in program
MyProger\Prog61977.cpp:16: error: stray '\227' in program
MyProger\Prog61977.cpp:16: error: stray '\128' in program
MyProger\Prog61977.cpp:16: error: stray '\128' in program
MyProger\Prog61977.cpp:16: error: stray '\227' in program
MyProger\Prog61977.cpp:16: error: stray '\128' in program
MyProger\Prog61977.cpp:16: error: stray '\128' in program
MyProger\Prog61977.cpp:17: error: stray '\227' in program
MyProger\Prog61977.cpp:17: error: stray '\128' in program
MyProger\Prog61977.cpp:17: error: stray '\128' in program
MyProger\Prog61977.cpp:17: error: stray '\227' in program
MyProger\Prog61977.cpp:17: error: stray '\128' in program
MyProger\Prog61977.cpp:17: error: stray '\128' in program
MyProger\Prog61977.cpp: In function `int main()':
MyProger\Prog61977.cpp:22: error: stray '\227' in program
MyProger\Prog61977.cpp:22: error: stray '\128' in program
MyProger\Prog61977.cpp:22: error: stray '\128' in program
MyProger\Prog61977.cpp:22: error: stray '\227' in program
MyProger\Prog61977.cpp:22: error: stray '\128' in program
MyProger\Prog61977.cpp:22: error: stray '\128' in program
MyProger\Prog61977.cpp:23: error: stray '\227' in program
MyProger\Prog61977.cpp:23: error: stray '\128' in program
MyProger\Prog61977.cpp:23: error: stray '\128' in program
MyProger\Prog61977.cpp:23: error: stray '\227' in program
MyProger\Prog61977.cpp:23: error: stray '\128' in program
MyProger\Prog61977.cpp:23: error: stray '\128' in program
MyProger\Prog61977.cpp:24: error: stray '\227' in program
MyProger\Prog61977.cpp:24: error: stray '\128' in program
MyProger\Prog61977.cpp:24: error: stray '\128' in program
MyProger\Prog61977.cpp:24: error: stray '\227' in program
MyProger\Prog61977.cpp:24: error: stray '\128' in program
MyProger\Prog61977.cpp:24: error: stray '\128' in program
MyProger\Prog61977.cpp:25: error: stray '\227' in program
MyProger\Prog61977.cpp:25: error: stray '\128' in program
MyProger\Prog61977.cpp:25: error: stray '\128' in program
MyProger\Prog61977.cpp:25: error: stray '\227' in program
MyProger\Prog61977.cpp:25: error: stray '\128' in program
MyProger\Prog61977.cpp:25: error: stray '\128' in program
MyProger\Prog61977.cpp:26: error: stray '\227' in program
MyProger\Prog61977.cpp:26: error: stray '\128' in program
MyProger\Prog61977.cpp:26: error: stray '\128' in program
MyProger\Prog61977.cpp:26: error: stray '\227' in program
MyProger\Prog61977.cpp:26: error: stray '\128' in program
MyProger\Prog61977.cpp:26: error: stray '\128' in program
MyProger\Prog61977.cpp:27: error: stray '\227' in program
MyProger\Prog61977.cpp:27: error: stray '\128' in program
MyProger\Prog61977.cpp:27: error: stray '\128' in program
MyProger\Prog61977.cpp:27: error: stray '\227' in program
MyProger\Prog61977.cpp:27: error: stray '\128' in program
MyProger\Prog61977.cpp:27: error: stray '\128' in program...................................................
-
02009-05-01 02:04:38@
#include
struct heap
{
int size,p,c;
int a[11000];
heap(){size = 0;}
void insert(int x)
{
for (p=++size;p>1 && a[p>>1]>x;a[p]=a[p>>1],p>>=1);
a[p]=x;
}
void pop(int &x)
{
for (x=a[p=1],c=2;c -
02009-04-23 20:26:30@
#include
int a[20001],t=0,n;
using namespace std;
int main()
{
a[0]=0;
void f(int k);
int i,k,n;
int s,sum=0;
scanf("%d",&n);
for(i=1;i -
02009-04-15 12:14:37@
var n,i,j,p,k,q,s:longint;
b:array[1..20000]of longint;
procedure quick(p,q:longint);
var i,j,k,r:longint;
begin
i:=p;
j:=q;
r:=b[(p+q) div 2];
repeat while b[i]r do dec(j);
if ij;
if j>p then quick(p,j);
if i -
02009-04-15 12:08:37@
var i,x,max,k,a,j,l,m,n,p,s,h:longint;
b:array[1..20000] of longint;
procedure f(p,q:longint);
var i,j,k,r:longint;
begin
i:=p;
j:=q;
r:=b[(p+q) div 2];
repeat
while b[i]r do dec (j);
if ij;
if j>p then f(p,j);
if i -
02009-04-15 12:01:41@
var
b:array[1..20000] of longint;
t,m,n,s,d:longint;
x1,x2,x3,x4,x5:longint;
procedure quiet(p,q:longint);
var
r,i,j,k,l:longint;
begin
i:=p;
j:=q;
r:=b[(p+q) div 2];
repeat
while b[i]r do j:=j-1;
if ij;
if j>p then quiet(p,j);
if i -
02009-04-08 12:59:40@
wt说的是实话.
-
02009-04-09 13:24:50@
哈program litao(input,output);
var
n,i,j,k,t:longint;
a:packed array[1..100000]of longint;
s:longint;
begin
readln(n);
for i:=1 to n do read(a[i]);
for i:=1 to 2 do
for j:=i+1 to n do
if a[i]>a[j] then begin
t:=a[i];a[i]:=a[j];a[j]:=t;
end;
s:=0;
for i:=1 to n-1 do
begin
a:=a[i]+a;
s:=s+a;
for j:=i+1 to i+2 do
for k:=j+1 to n do
if a[j]>a[k] then begin
t:=a[j];a[j]:=a[k];a[k]:=t;end;
end;
writeln(s);
end. -
02009-04-08 14:56:13@
。
-
02009-04-07 13:29:19@
别信楼下一群人的鬼话!!!!!!!!!!!!!!!!!!!!!
program dyh(input,output);
var
n,i,j,k,t:longint;
a:packed array[1..100000]of longint;
s:longint;
begin
readln(n);
for i:=1 to n do read(a[i]);
for i:=1 to 2 do
for j:=i+1 to n do
if a[i]>a[j] then begin
t:=a[i];a[i]:=a[j];a[j]:=t;
end;
s:=0;
for i:=1 to n-1 do
begin
a:=a[i]+a;
s:=s+a;
for j:=i+1 to i+2 do
for k:=j+1 to n do
if a[j]>a[k] then begin
t:=a[j];a[j]:=a[k];a[k]:=t;end;
end;
writeln(s);
end.
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms
(测评结果是假的)
另希望管理员把wt dengke slm 的号给封了 -
02009-04-05 11:37:48@
slm的题解,我看过了,错得很离谱,千万不要相信他!
-
02009-04-04 21:14:49@
program vo;
var a:array[1..1000]of longint;
var n,i,j,s,t:longint;
begin
read(n);
for i:=1 to n do read(a[i]);
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j] then begin t:=a[i];a[i]:=a[j];a[j]:=t;end;
for i:=2 to n do
for j:=1 to i do
s:=s+a[j];
writeln(s);
end.