zoj - 3502 Contest
题意::&& 题解 ::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相关推荐
- ZOJ 3502 Contest 状态压缩 概率 DP
链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3502 1 #include <iostream> 2 # ...
- ZOJ 3703 Happy Programming Contest 0-1背包 DP
ZOJ 3703 Happy Programming Contest 题目描述: 题目链接:ZOJ 3703 Happy Programming Contest 题目大意: 这是一道虐狗的题目.讲的是 ...
- *【ZOJ - 3703】Happy Programming Contest(带优先级的01背包)
题干: In Zhejiang University Programming Contest, a team is called "couple team" if it consi ...
- 【ZOJ - 3703】Happy Programming Contest(带优先级的01背包,贪心背包)
题干: In Zhejiang University Programming Contest, a team is called "couple team" if it consi ...
- 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 ...
- ZOJ 3872 Beauty of Array (The 12th Zhejiang Provincial Collegiate Programming Contest )
[题目链接]click here~~ [题目大意]定义Beauty数是一个序列里所有不相同的数的和,求一个序列所有字序列的Beauty和 1 <= N <= 100000 [解题思路]由于 ...
- 【转载】图论 500题——主要为hdu/poj/zoj
转自--http://blog.csdn.net/qwe20060514/article/details/8112550 =============================以下是最小生成树+并 ...
- 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 ...
- UVA10258 ZOJ1837 Contest Scoreboard【结构排序】
Contest Scoreboard Time Limit: 2 Seconds Memory Limit: 65536 KB Think the contest score boards are w ...
最新文章
- ROS话题通信中创建自定义数据类型的两种方式
- mongodb java项目 源码_spring项目整合mongodb进行开发
- windows7、windows 2008和windows 2008 R2 的系统封装介绍
- 让Double类型完整显示,不用科学计数法显示E(Java)
- 通过mtd读写flash_敏矽微电子Cortex-M0学习笔记11-FLASH存储器
- 封装CopyFileEx函数,实现文件复制中的暂停,控速,获取进度。
- (STL,set,priority_queue)丑数
- java 获取内存地址_Java 的多态在 JVM 里原来是这样的
- 点击头像显示大图Dialog
- 【iCore4 双核心板_ARM】例程十一:DMA实验——存储器到存储器的传输
- POJ 3461 Oulipo
- FaceBoundingBoxInInfraredSpace 得到的深度空间的数值为空
- excel如何拟合直线(怎样用excel拟合直线)
- 几款引擎比较:BigWorld,Unreal,CryEngine等
- linux 压缩文件 zip,linux zip命令压缩zip文件详解
- Integrated Skills of English_Unit2_Why My Great-uncle Gave Up the Ministry
- S19文件解析实现代码
- ZOJ 1598 Spherical Triangle
- 关于收音机的一些问题
- flowable 和activiti 数据库表结构对比说明