- 校门外的树
- 2009-03-26 20:37:17 @
program xiaomenwaideshu;
var a,b,i,j,d,t:integer;
spot: array[1..10000] of integer;
spo: array[1..10000] of integer;
begin
read(a,b);
a:=a+1;
for i:=1 to b do
begin
readln(spot[i],spo[i]);
t:=abs(spot[i]-spo[i])+1;
a:=a-t;
end;
for i:=2 to b do
for j:=1 to b-1 do
if (spo[i]>spot[j]) and (spo[i]< spo[j]) then
begin
d:=abs(spot[j]-spo[i])+1;
a:=a+d;
end;
writeln(trunc(a));
end.
2 条评论
-
唐复之 LV 8 @ 2016-08-19 13:42:17
什么东西变长……
-
2016-08-19 13:42:02@
#include<iostream> using namespace std; int x[10010]={0},l,m; long total=0; int main() { cin>>l>>m; for(int i=0;i<=l;i++) x[i]=1; int a,b; for(int i=0;i<=m;i++) { cin>>a>>b; for(int j=a;j<=b;j++) x[j]=0; } for(int i=0;i<=l;i++) total+=x[i]; cout<<total; return 0; }
你讲的变长……是……什么鬼……
- 1