[BZOJ1800] [Ahoi2009]fly 飞行棋

传送门

http://www.lydsy.com/JudgeOnline/problem.php?id=1800

题目大意

。。。

题解

求出直径数, ans=(1)2

var
 x:array[0..100]of longint;
 i,j,k,n,m,ans,sum:longint;
begin
 readln(n); x[1]:=0; sum:=0;
 for i:=2 to n do
  begin
   readln(x[i]); inc(sum,x[i]); inc(x[i],x[i-1]);
  end;
 readln(j); inc(sum,j);
 sum:=sum>>1; ans:=0;
 for i:=1 to n do
  for j:=1 to n do
   if abs(x[j]-x[i])=sum
   then begin inc(ans); break; end;
 ans:=ans>>1;
 ans:=(ans*(ans-1))div 2;
 writeln(ans);
end.

你可能感兴趣的:([BZOJ1800] [Ahoi2009]fly 飞行棋)