讨论 / 各位速看,接水咋错了...
五位君臣.. 2012-11-17 11:30:00
点我顶贴 收藏 删除
var

i,j,x,y,n,m,i1,t:longint;

w:array[1..10000] of longint;

a:array[1..100] of longint;

tf:boolean;

tf1,tf2,tf3:boolean;

begin

readln(n,m);

for i:=1 to n do

read(w[i]);

for i:=1 to n do

for i1:=i+1 to n do

if w[i]>w[i1] then begin t:=w[i];w[i]:=w[i1];w[i1]:=t; end;

repeat

for i:=1 to m do

begin

tf:=false;

tf1:=false;

tf2:=false;

if (a[i]=0) then begin inc(j); a[i]:=w[j];tf1:=true; end;

if(a[i]-1=0) and (tf1=false) then begin inc(j); a[i]:=w[j];tf2:=true;end;

if (a[i]>0) and (tf1=false) and (tf2=false) and (tf3<>true)then begin dec(a[i]); tf3:=true;end;

end;

for y:=1 to m do

if a[y]=0 then tf:=true else begin tf:=false; break; end;

if tf3=true then inc(x);

until tf=true;

writeln(x);

end.

#1 殺魂の魄@2011-04-05 17:52:00
回复 删除
???

是接水问题么??、

#2 殺魂の魄@2011-04-05 17:52:00
回复 删除
嗨!

你是老王么??

(王健聪)

#3 垃圾桶@2011-04-10 17:59:00
回复 删除

type sss=record

num:integer;

ju:0..1;

end;

var ans,x,a,b,i,j,k,t,n:longint;

s:array[1..100000]of sss;

m:array[1..10000]of integer;

begin

readln(n,b);

t:=n;

x:=n;

for i:=1 to n do

read(s[i].num);

while t<>0 do

inc(ans);

begin

if t>b then begin

for i:=1 to b do

begin

inc(m[i]);

if m[i]=s[i].num

then begin t:=t-1; s[i].num:=s[x+1].num; x:=x+1; m[i]:=0;end;

end;

end;

if t<=b then

for i:=1 to t do

begin

inc(m[i]);

if m[i]=s[i].num then t:=t-1;

end;

end;

end.

#4 灰天飞雁@2011-04-11 12:58:00
回复 删除
表示我考试时是简单模拟+1个时优化然后AC了....
#5 垃圾桶@2011-05-13 17:59:00
回复 删除

type ar=array[1..1000]of integer;

var m,n,a,b,i,j,k,t,x,y,l,r:integer;

s,w:array[1..1000]of ar;

function take(s:ar):integer;

var x:integer;

begin

for i:=n-m to k do if s[i]>x then x:=i;

take:=s[x];

end;

function ans(s:ar):integer;

var x:integer;

begin

for i:=1 to m do if s[i]>x then x:=i;

ans:=s[x];

end;

procedure sort(l,r:integer);

var i,j,x,y:integer;

begin

i:=l; j:=r;

repeat

while w[i]<x inc(i);

while x<w[j] dec(j);

if i<=j then

begin

y:=a[i]; a[i]:=a[j]; a[j]:=y;

inc(i); dec(j);

end;

until i>j;

if i<r then sort(i,r);

if l<j then sort(l,j);

end;

{main}

begin

l:=1; r:=n;

#6 675694756@2011-08-24 16:55:00
回复 删除
11

WA:50,后面都有错,看看吧

program moni;

var

i,s,t,n,m,x:integer;

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

begin

readln(n,m);

s:=0;t:=0;

x:=m+1;

for i:=1 to n do

begin

read(a[i]);

s:=s+a[i];

end;

while s>0 do

begin

for i:=1 to m do

begin

if a[i]<>0 then begin

s:=s-1;

a[i]:=a[i]-1;

end;

if a[i]=0 then begin

if a[x]<>0 then

begin

a[i]:=a[x];

x:=x+1;

end;

end;

end;

t:=t+1;

end;

writeln(t);

end.

#7 罗极羽@2011-12-11 12:02:00
回复 删除
xxx神马地方错了

状态: Unaccepted

测评机: Xeost[5]

得分: 80分

提交日期: 2011-12-11 11:59:00

有效耗时: 952毫秒

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

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

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

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

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

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

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

测试结果8: 运行错误|普通保护错误

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

测试结果10: 运行错误|普通保护错误

#8 wu_hong_xun@2012-11-17 11:30:00
回复 删除
program water;

var

n,m,i,l,t:longint;

a:array [1..100] of longint;

w:array [1..10000] of longint;

begin

readln(n,m);

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

for i:=1 to m do a[i]:=w[i];

t:=0;

l:=m+1;

repeat

inc(t);

for i:=1 to m do if a[i]=t then begin n:=n-1;a[i]:=a[i]+w[l];inc(l);end;

until n=0;

write (t);

end.

查看更多回复
提交回复