NOIP2016普及组 总结

lzusa 发布于 2019-04-18 0 次阅读


!!!!!!!!!!!!!!!!

T1 100
T2 100
T3 70
T4 0


T1
水题
波波尽然连70都没有!!!!!!!!!!!!!!


T2
水题
强行枚举每一天,判断一下,然后加一天就可以了
只是要注意一下闰年之类的


T3
暴力枚举每一个70,据说是树状数组


T4
先排序然后暴力找,然而没有注意到会有重复的魔法值的情况。。。所以爆0,不然60


T1

var
  i,j,k,n,m,s,x,y,ans:longint;
begin

  readln(n);
  ans:=maxlongint;
  for i:=1 to 3 do
    begin
      read(x,y);
      j:=n div x;
      if n-j*x>0 then inc(j);
      if ans>j*y then ans:=j*y;
    end;
  writeln(ans);
end.

T2

const
  f:array[1..12] of integer=(31,28,31,30,31,30,31,31,30,31,30,31);
var
  i,j,k,n,m,x,y,z,l,r,ans,o,h:longint;
  st:string;
begin
  readln(n,m);
  str(n,st);
  val(copy(st,1,4),x);
  val(copy(st,5,2),y);
  val(copy(st,7,2),z);

  l:=m-n;
  for i:=1 to maxlongint do
    begin
      r:=x*10000+y*100+z;
      if r>m then break;
      str(r,st);
      j:=1; k:=8;
      while (st[j]=st[k]) do begin inc(j); dec(k); end;
      if (kf[y]) and (y<>2) then
        begin
          z:=1;
          inc(y);
          if (y=13) then
            begin
              y:=1;
              inc(x);
            end;
        end;
       if y=2 then
         begin

           o:=0;
           if ((x mod 4=0) and (x mod 100<>0)) or ((x mod 400=0)) then
              o:=1;
           if ((x mod 4=0) and (x mod 100<>0)) and ((x mod 400=0)) then
              o:=0;
           if (z>28+o) then
             begin
               z:=1;
               inc(y);
               if (y=13) then
                 begin
                   y:=1;
                   inc(x);
                 end;
             end;
         end;
    end;
  writeln(ans);
end.

T3

var
  f,fl:array[0..5000] of int64;
  a:array[0..5000,-10..5000] of int64;
  i,j,k,n,m,s,x,y,z,ans:longint;
begin
  readln(n);
  for i:=1 to n do
    begin
      read(a[i,-1],a[i,0]);
      for j:=1 to a[i,0] do
        read(a[i,j]);
    end;
  for i:=1 to n do
    begin
      for j:=1 to a[i,0] do
        begin
          if f[a[i,j]]=0 then inc(ans);
          inc(f[a[i,j]]);
        end;
      for j:=1 to i-1 do
        if (a[i,-1]-a[j,-1]>86400) and (fl[j]=0) then
          begin
            fl[j]:=1;
            for k:=1 to a[j,0] do
              begin
                if f[a[j,k]]=1 then dec(ans);
                dec(f[a[j,k]]);
              end;
          end;
      writeln(ans);
    end;
end.

T4

0分

var
  a:array[0..100000,1..2] of longint;
  f:array[0..100000,1..4] of longint;
  i,j,k,n,m,x,y,z,l,r,o:longint;
procedure qsort(l,r:longint);
var
  mid,i,j,temp:longint;
begin
  i:=l; j:=r;
  mid:=a[random(r-l+1)+l,1];
  repeat
    while a[i,1]mid do dec(j);
    if (i<=j) then
      begin
      temp:=a[i,1];
      a[i,1]:=a[j,1];
      a[j,1]:=temp;
      temp:=a[i,2];
      a[i,2]:=a[j,2];
      a[j,2]:=temp;
      inc(i); dec(j);
      end;
  until i>=j;
  if il then qsort(l,j);
end;
begin
assign(input,'magic.in'); reset(input);
assign(output,'magic.out'); rewrite(output);
  randomize;
  readln(m,n);
  for i:=1 to n do
    begin
      readln(a[i,1]);
      a[i,2]:=i;
    end;
  qsort(1,n);

  for i:=1 to n-3 do
    begin
      for j:=i+1 to n-2 do
        begin
          k:=j+1;
          while (a[k,1]-a[j,1]<=(a[j,1]-a[i,1])*3) and (k

60分

var
  a:array[0..100000,1..2] of longint;
  f:array[0..100000,1..4] of longint;
  i,j,k,n,m,x,y,z,l,r,o:longint;
procedure qsort(l,r:longint);
var
  mid,i,j,temp:longint;
begin
  if l>r then exit;
  i:=l; j:=r;
  mid:=a[random(r-l+1)+l,1];
  repeat
    while a[i,1]mid do dec(j);
    if (i<=j) then
      begin
      temp:=a[i,1];
      a[i,1]:=a[j,1];
      a[j,1]:=temp;
      temp:=a[i,2];
      a[i,2]:=a[j,2];
      a[j,2]:=temp;
      inc(i); dec(j);
      end;
  until i>=j;
  if il then qsort(l,j);
end;
begin
  randomize;
  readln(m,n);
  for i:=1 to n do
    begin
      readln(a[i,1]);
      a[i,2]:=i;
    end;
  qsort(1,n);

  for i:=1 to n-3 do
    begin
      for j:=i+1 to n-2 do
        begin
          k:=j+1;
          while (a[k,1]-a[j,1]<=(a[j,1]-a[i,1])*3) and (k

总结

要注意题目中的特殊情况,不要删去那些自认为可以删去的判断,不要相信样例
能水的尽量水,做完要好好思考一下程序有没有神奇的bug
总之最后差一点一等还是有点可惜,然后也要面临可以说是我人生中最重要的一次月考了,也不知能否顺利渡劫,如果过了这关的话日子就好过很多了
祝自己 rp++!


 

]]>