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.
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.
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;
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.
状态: 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: 运行错误|普通保护错误
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.