不知错误

var l,m,q,w,z,x,d:integer;

a,b,c:array[1..255]of integer;

begin

d:=0;

readln(l,m);

for q:=1 to m do read(a[q]);

for w:=1 to m do read(b[w]);

for z:=1 to m do begin

if b[z]=a[z+1] then begin c[z]:=1+b[z]-a[z]+1+b[z+1]-a[z+1]-(1+b[z]-a[z+1]);

c[z+1]:=0;

end;

end;

for x:=1 to 255 do d:=c[x]+d;

writeln(l-d);

end.

4 条评论

  • @ 2014-07-24 21:28:24

    var
    a:array[0..10000] of 0..1;
    i,j,l,m,s,x,y:longint;
    begin
    fillchar (a,sizeof(a),1);
    readln (l,m);
    for i:=1 to m do
    begin
    readln (x,y);
    for j:=x to y do a[j]:=0;
    end;
    s:=0;
    for i:=0 to l do if a[i]=1 then inc(s);
    write (s);
    end.

  • @ 2014-07-24 21:26:32

    var
    a:array[0..10000] of 0..1;
    i,j,l,m,s,x,y:longint;
    begin
    fillchar (a,sizeof(a),1);
    readln (l,m);
    for i:=1 to m do
    begin
    readln (x,y);
    for j:=x to y do a[j]:=0;
    end;
    s:=0;
    for i:=0 to l do if a[i]=1 then inc(s);
    write (s);
    end.

  • @ 2013-03-18 20:34:21

    program asdflk;
    var
    L,M,i,j,e:longint;
    a,b,c:array[0..10000]of longint;
    begin
    read(L,M);
    for i:=0 to l do a[i]:=1;
    for i:=1 to m do read(b[i],c[i]);
    for i:=1 to m do
    for j:=b[i] to c[i] do a[j]:=0;
    for i:=0 to l do if a[i]=1 then inc(e);
    write(e);
    end.

  • @ 2012-10-07 20:49:53

    var

    02 a:array[0..10000] of integer;

    03 b,c,d,e,f,g,t:integer;

    04 begin

    05 read(b,d);

    06 for c:=1 to d do begin

    07 read(e,f);

    08 for g:=e to f do a[g]:=a[g]-1;

    09 end;

    10 for g:=0 to b do if a[g]=0 then t:=t+1;

    11 write(t);

    12 end .

    自己看

  • 1

信息

ID
1103
难度
4
分类
模拟 点击显示
标签
递交数
14290
已通过
6515
通过率
46%
被复制
50
上传者