一道非常神奇的题目

var v:array[0..10010] of boolean;

    n,k,i,x,ans,s:longint;

begin

  readln(n,k);

  fillchar(v,sizeof(v),false);

  ans:=1;

  for i:=1 to n do

  begin

    readln(x);

    if not v[x] then

    begin

      inc(s);

      if s=k then

      begin

        fillchar(v,sizeof(v),false);

        inc(ans);

        s:=0;

      end

      else v[x]:=true;

    end;

  end;

  writeln(ans);

end.

稍微想想就明白了

 

posted on 2014-03-16 23:08  acphile  阅读(115)  评论(0)    收藏  举报