bzoj 1800 暴力枚举
2014-01-01 20:15
302 查看
直接暴力枚举四个点,然后判断是否能组成矩形就行了
注意枚举的点的标号从小到大,保证不重复枚举
注意枚举的点的标号从小到大,保证不重复枚举
/************************************************************** Problem: 1800 User: BLADEVIL Language: Pascal Result: Accepted Time:0 ms Memory:224 kb ****************************************************************/ //By BLADEVIL var n :longint; sum :array[0..21] of longint; i, j, k, l :longint; a, b, c, d :longint; tot, ans :longint; function min(a,b:longint):longint; begin if a>b then min:=b else min:=a; end; begin read(n); for i:=2 to n+1 do read(sum[i]); for i:=2 to n+1 do inc(tot,sum[i]); for i:=1 to n do sum[i]:=sum[i]+sum[i-1]; for i:=1 to n do for j:=i+1 to n do for k:=j+1 to n do for l:=k+1 to n do begin a:=sum[j]-sum[i]; a:=min(tot-a,a); b:=sum[k]-sum[j]; b:=min(tot-b,b); c:=sum[l]-sum[k]; c:=min(c,tot-c); d:=abs(sum[l]-sum[i]); d:=min(d,tot-d); if (a=c) and (b=d) then inc(ans); end; writeln(ans); end.
相关文章推荐
- [AHOI2009][BZOJ1800] fly 飞行棋|枚举|暴力
- 【枚举】bzoj1800 [Ahoi2009]fly 飞行棋
- BZOJ 1800: [Ahoi2009]fly 飞行棋【思维题,n^4大暴力】
- BZOJ 1800 AHOI2009 fly 飞行棋 暴力
- BZOJ 1800: [Ahoi2009]fly 飞行棋( 枚举 )
- BZOJ-3190-赛车-JLOI2013-暴力枚举
- bzoj 1028 暴力枚举判断
- BZOJ1800 [Ahoi2009]fly 飞行棋 【枚举】
- BZOJ1800 [Ahoi2009]fly 飞行棋 【枚举】
- bzoj 1800: [Ahoi2009]fly 飞行棋 暴力
- bzoj 1024: [SCOI2009]生日快乐(暴力dfs枚举所有情况)
- BZOJ 1050 旅行comf【暴力枚举+生成树】
- bzoj 1800: [Ahoi2009]fly 飞行棋【枚举】
- BZOJ 1800: [Ahoi2009]fly 飞行棋【暴力】
- bzoj1028 [JSOI2007]麻将(暴力枚举+贪心)
- Bzoj 2241: [SDOI2011]打地鼠 暴力,枚举,贪心
- bzoj 4292: [PA2015]Równanie 暴力枚举
- BZOJ3251 暴力
- 【bzoj 十连测】[noip2016 第一场]Problem B. Tourist Attractions(枚举)
- poj 1035 串 枚举 暴力 tmp.insert(i, 1, current[i]); //谁能告诉我这句什么意思?