标签:des style blog http color os io for
N<= 20
题解:
大暴力术之术!
四个点构成矩形需要满足两个条件:
1.对边相等
2.对角线为直径
代码:
1 var tot,i,j,k,l,n,ans,x:longint; 2 a:array[0..25] of longint; 3 procedure init; 4 begin 5 readln(n); 6 a[0]:=0; 7 for i:=1 to n do begin readln(x);a[i]:=a[i-1]+x;end; 8 end; 9 procedure main; 10 begin 11 tot:=a[n]; 12 for i:=1 to n do 13 for j:=i+1 to n do 14 for k:=j+1 to n do 15 for l:=k+1 to n do 16 if (a[j]-a[i]=a[l]-a[k]) and (tot-(a[l]-a[j])=a[k]-a[i]) then inc(ans); 17 writeln(ans); 18 end; 19 20 begin 21 assign(input,‘input.txt‘);assign(output,‘output.txt‘); 22 reset(input);rewrite(output); 23 init; 24 main; 25 close(input);close(output); 26 end.
BZOJ1800: [Ahoi2009]fly 飞行棋,布布扣,bubuko.com
标签:des style blog http color os io for
原文地址:http://www.cnblogs.com/zyfzyf/p/3910281.html