为什么我90分第一个数据错了?

var judge:array[-1..10000] of boolean;

a,b,m,n,i,j,total:integer;

begin

readln(m,n);

fillchar(judge,sizeof(judge),true);

for i:=1 to n do

begin

read(a,b);

for j:=a to b do

judge[j]:=false;

end;

total:=0;

for i:=1 to m do

if judge[i] then total:=total+1;

write(total+1);

end.

5 条评论

  • @ 2015-02-10 11:22:57

    var l,m,i,j,num:longint;
    a:array[1..10000,1..2]of longint;
    b:array[1..10000]of boolean;
    procedure init;
    begin
    read(l,m);
    for i:=1 to m do readln(a[i,1],a[i,2]);
    for i:=0 to l do b[i]:=true;
    end;
    procedure deal;
    begin
    for i:=0 to m do
    for j:=a[i,1] to a[i,2] do
    b[j]:=false;
    end;
    procedure addprint;
    begin
    for i:=1 to l do if b[i] then inc(num);
    write(num+1);
    end;
    begin
    init;
    deal;
    addprint;
    end.

  • @ 2014-11-02 08:49:11

    我也90,谁能帮我看看,感激不尽。
    program aa;
    var a:array[0..10000]of integer;
    l,i,j,m,x,y,ans:integer;
    begin
    readln(l,m);
    ans:=0;
    for i:=1 to l do a[i]:=1;
    for i:=1 to m do
    begin
    readln(x,y);
    for j:=x to y do
    a[j]:=0;
    end;
    for i:=0 to l do
    if a[i]=1 then inc(ans);
    writeln(ans+1);
    end.

    • @ 2014-11-02 08:53:02


      不用了,我改过来了
      我这个就当个错误范本吧
      for i:= 0 to l do a[i]:=1;\\
      writeln(ans);\\

  • @ 2013-08-19 16:06:37

    我一开始也是90,和你一样,后来过了
    for i:=1 to m do,你得从0开始搜

  • @ 2013-04-13 18:02:07

    for i:=0 to m do
    if judge[i] then total:=total+1;
    应该是这样,再试试

  • @ 2009-08-04 16:46:40

    type

    re=record

    date:integer;

    date2:integer;

    end;

    var

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

    b:array[1..10000] of boolean;

    l,i,j,k,temp,max:integer;

    begin

    readln(l,k);

    fillchar(b,sizeof(b),true);

    for i:=1 to k do readln(a[i].date,a[i].date2);

    for i:=1 to k do for j:=a[i].date to a[i].date2 do b[j]:=false;

    for i:=0 to l do if b[i] then inc(max);

    writeln(max);

    end.

    兄弟..我的也是啊

    第一个数据没过,多了一..

    可能少看了一个细节吧..望知情的大牛出声纠正.哈

  • 1

信息

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