题意::&& 题解  ::here~~~~~~~~

#include<cstdio>
#include<cmath>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int M = (1 << 10);
#define esp 1e-8
string s[M+1];
double map[15][15];
double dp[M];
int pre[M];
int main(){int t,n;cin >> t;while(t--){cin >> n;for(int i = 0;i < n;i++){for(int j = 0;j < n;j++){cin >> map[i][j];map[i][j] /= 100;}}int cnt = 1 <<n;s[0] = "";dp[0] = 0;memset(pre,0,sizeof(pre));for(int i = 1;i < cnt ;i++){dp[i] = -1;for(int j = n-1;j >= 0;j--){if(!(i&(1<<j))) continue;double p = 0;for(int k = n-1;k >= 0;k--){int temp = 1 << k;if(!(i&temp)) continue;p = max(p,map[k][j]);}p = p + dp[i-(1<<j)];if(dp[i] + esp < p || (dp[i] - esp < p && s[i-(1<<j)] < s[i])){dp[i] = p;s[i] = s[i-(1<<j)];s[i] += ('A' + j);}}}printf("%.2lf\n",dp[cnt-1]);cout << s[cnt-1] << endl;}
}

zoj - 3502 Contest相关推荐

  1. ZOJ 3502 Contest 状态压缩 概率 DP

    链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3502 1 #include <iostream> 2 # ...

  2. ZOJ 3703 Happy Programming Contest 0-1背包 DP

    ZOJ 3703 Happy Programming Contest 题目描述: 题目链接:ZOJ 3703 Happy Programming Contest 题目大意: 这是一道虐狗的题目.讲的是 ...

  3. *【ZOJ - 3703】Happy Programming Contest(带优先级的01背包)

    题干: In Zhejiang University Programming Contest, a team is called "couple team" if it consi ...

  4. 【ZOJ - 3703】Happy Programming Contest(带优先级的01背包,贪心背包)

    题干: In Zhejiang University Programming Contest, a team is called "couple team" if it consi ...

  5. ZOJ 142 - The 14th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple - D

    Let's Chat Time Limit: 1 Second Memory Limit: 65536 KB ACM (ACMers' Chatting Messenger) is a famous ...

  6. ZOJ 3872 Beauty of Array (The 12th Zhejiang Provincial Collegiate Programming Contest )

    [题目链接]click here~~ [题目大意]定义Beauty数是一个序列里所有不相同的数的和,求一个序列所有字序列的Beauty和 1 <= N <= 100000 [解题思路]由于 ...

  7. 【转载】图论 500题——主要为hdu/poj/zoj

    转自--http://blog.csdn.net/qwe20060514/article/details/8112550 =============================以下是最小生成树+并 ...

  8. HDU 4430 amp; ZOJ 3665 Yukari#39;s Birthday(二分法+枚举)

    主题链接: HDU:http://acm.hdu.edu.cn/showproblem.php?pid=4430 ZJU:http://acm.zju.edu.cn/onlinejudge/showP ...

  9. UVA10258 ZOJ1837 Contest Scoreboard【结构排序】

    Contest Scoreboard Time Limit: 2 Seconds Memory Limit: 65536 KB Think the contest score boards are w ...

最新文章

  1. ROS话题通信中创建自定义数据类型的两种方式
  2. mongodb java项目 源码_spring项目整合mongodb进行开发
  3. windows7、windows 2008和windows 2008 R2 的系统封装介绍
  4. 让Double类型完整显示,不用科学计数法显示E(Java)
  5. 通过mtd读写flash_敏矽微电子Cortex-M0学习笔记11-FLASH存储器
  6. 封装CopyFileEx函数,实现文件复制中的暂停,控速,获取进度。
  7. (STL,set,priority_queue)丑数
  8. java 获取内存地址_Java 的多态在 JVM 里原来是这样的
  9. 点击头像显示大图Dialog
  10. 【iCore4 双核心板_ARM】例程十一:DMA实验——存储器到存储器的传输
  11. POJ 3461 Oulipo
  12. FaceBoundingBoxInInfraredSpace 得到的深度空间的数值为空
  13. excel如何拟合直线(怎样用excel拟合直线)
  14. 几款引擎比较:BigWorld,Unreal,CryEngine等
  15. linux 压缩文件 zip,linux zip命令压缩zip文件详解
  16. Integrated Skills of English_Unit2_Why My Great-uncle Gave Up the Ministry
  17. S19文件解析实现代码
  18. ZOJ 1598 Spherical Triangle
  19. 关于收音机的一些问题
  20. flowable 和activiti 数据库表结构对比说明

热门文章

  1. 在创业之路上不断创新
  2. webrtc收包流程源码分析
  3. ERROR 1436 (HY000) at line 1943
  4. Python大数据:jieba分词,词频统计
  5. 【面试题】C语言:模拟实现memcmp,试比较memcmp与strcmp,strncmp的区别
  6. C语言库函数大全及应用实例十四
  7. PHP获取当前页面的URL
  8. 推荐15个在线多媒体(图片、音频、视频)编辑器
  9. sainsbury newspaper collection time
  10. shanghai hongqiao railway station