bzoj1800 [Ahoi2009]fly 飞行棋 暴力枚举
来源:互联网 发布:网络层协议有哪些 编辑:程序博客网 时间:2024/05/16 01:30
啊啊啊我要疯了!!!tmd这么水的题目我居然因为一个地方打错调了半个小时,我是不是傻逼啊。
#include<cstdio>#include<algorithm>#include<cstring>#define fo(i,a,b) for(int i=a;i<=b;i++)#define fd(i,a,b) for(int i=a;i>=b;i--)using namespace std;const int N=25;typedef long long ll;int n,m;int ans;int vis[N];int a[N];ll mp[N][N];inline void solve(){ static int b[5]; int tot=0; fo(i,1,20)if (vis[i])b[++tot]=i; if(tot!=4)return; if (mp[b[1]][b[2]]==mp[b[3]][b[4]]&&mp[b[2]][b[3]]==mp[b[1]][b[4]])ans++;}inline void dfs(int x,int dep){ if (dep==4||x==n+1) { solve(); return; } dfs(x+1,dep); vis[x]=1; dfs(x+1,dep+1); vis[x]=0;}int main(){ scanf("%d",&n); ll sum=0; fo(i,1,n)scanf("%d",&a[i]),sum+=a[i]; fo(i,1,n) { fo(j,i+1,n) { ll tmp=0; fo(k,i,j-1)tmp+=a[k]; mp[i][j]=min(tmp,sum-tmp); mp[j][i]=mp[i][j]; } } /*fo(i,1,n) { fo(j,1,n)printf("%lld ",mp[i][j]); printf("\n"); }*/ dfs(1,0); printf("%d\n",ans); return 0;}
阅读全文
0 0
- bzoj1800 [Ahoi2009]fly 飞行棋 暴力枚举
- 【BZOJ1800】【Ahoi2009】fly 飞行棋
- [BZOJ1800][Ahoi2009]fly飞行棋
- 【AHOI2009】【BZOJ1800】fly 飞行棋
- [BZOJ1800] [Ahoi2009]fly 飞行棋
- BZOJ1800: [Ahoi2009]fly 飞行棋
- bzoj1800: [Ahoi2009]fly 飞行棋
- bzoj1800 [Ahoi2009]fly 飞行棋
- 【bzoj1800】[Ahoi2009]fly 飞行棋
- bzoj1800: [Ahoi2009]fly 飞行棋 统计直径
- BZOJ1800(Ahoi2009)[fly 飞行棋]--几何
- BZOJ 1800 AHOI2009 fly 飞行棋 暴力
- [BZOJ1800]AHOI2009 FLY
- 1800: [Ahoi2009]fly 飞行棋
- [Ahoi2009]fly 飞行棋
- 1800: [Ahoi2009]fly 飞行棋
- 1800: [Ahoi2009]fly 飞行棋
- 1800: [Ahoi2009]fly 飞行棋
- php中JSON的使用与转换
- 查看表索引
- XGBoost-Python完全调参指南-参数解释篇
- vue命名路由
- mysql 1045解决方法
- bzoj1800 [Ahoi2009]fly 飞行棋 暴力枚举
- 笔记
- 2017/9/21工作总结
- 数据库导入导出数据以及字段类型为timestamp时的设值问题
- HashMap和HashTable的区别和联系
- 网络编程
- 王者荣耀_KEY
- doppia调试之旅
- 微信小程序音频播放