2013长沙赛区现场赛 J - Josephina and RPG
Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Description
Recently, Josephina is busy playing a RPG named TX3. In this game, M characters are available to by selected by players. In the whole game, Josephina is most interested in the "Challenge Game" part.
The Challenge Game is a team play game. A challenger team is made up of three players, and the three characters used by players in the team are required to be different. At the beginning of the Challenge Game, the players can choose any characters combination as the start team. Then, they will fight with N AI teams one after another. There is a special rule in the Challenge Game: once the challenger team beat an AI team, they have a chance to change the current characters combination with the AI team. Anyway, the challenger team can insist on using the current team and ignore the exchange opportunity. Note that the players can only change the characters combination to the latest defeated AI team. The challenger team gets victory only if they beat all the AI teams.
Josephina is good at statistics, and she writes a table to record the winning rate between all different character combinations. She wants to know the maximum winning probability if she always chooses best strategy in the game. Can you help her?
Input
Output
Sample Input
0.50 0.50 0.20 0.30
0.50 0.50 0.90 0.40
0.80 0.10 0.50 0.60
0.70 0.60 0.40 0.50
3
0 1 2
Sample Output
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#define INF 0x3f3f3f3f
#define M(a,b) memset(a,b,sizeof(a)) using namespace std; double num[125][125];
int cp[10050];
double dp[10050][125]; double max(double a,double b)
{
if(a>b) return a;
else return b;
} int main()
{
int t;
int r;
while(scanf("%d",&t)==1)
{
int tp = 1;
for(int i = t;i>t-3;i--) tp*=i;
tp/=6; for(int i = 0;i<tp;i++)
for(int j = 0;j<tp;j++)
{
scanf("%lf",&num[i][j]);
} scanf("%d",&r);
for(int i = 0;i<r;i++)
scanf("%d",&cp[i]); for(int i = 0;i<tp;i++) dp[0][i] = num[i][cp[0]]; for(int x = 1;x<r;x++)
{
dp[x][cp[x-1]] = 0;
for(int i = 0;i<tp;i++)
{
dp[x][cp[x-1]] = max(dp[x][cp[x-1]],dp[x-1][i]*num[cp[x-1]][cp[x]]);
if(i!=cp[x-1])
dp[x][i] = dp[x-1][i]*num[i][cp[x]];
}
} double ans = 0;
for(int i = 0;i<tp;i++)
if(ans<dp[r-1][i]) ans = dp[r-1][i];
printf("%.6f\n",ans);
}
return 0;
}
2013长沙赛区现场赛 J - Josephina and RPG的更多相关文章
- 2013区域赛长沙赛区现场赛 K - Pocket Cube
K - Pocket Cube Time Limit:10000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Su ...
- HDU 4793 Collision (解二元一次方程) -2013 ICPC长沙赛区现场赛
题目链接 题目大意 :有一个圆硬币半径为r,初始位置为x,y,速度矢量为vx,vy,有一个圆形区域(圆心在原点)半径为R,还有一个圆盘(圆心在原点)半径为Rm (Rm < R),圆盘固定不动,硬 ...
- HDU 4800/zoj 3735 Josephina and RPG 2013 长沙现场赛J题
第一年参加现场赛,比赛的时候就A了这一道,基本全场都A的签到题竟然A不出来,结果题目重现的时候1A,好受打击 ORZ..... 题目链接:http://acm.hdu.edu.cn/showprobl ...
- 2014 ACM/ICPC 鞍山赛区现场赛 D&I 解题报告
鞍山现场赛结束了呢-- 我们出的是D+E+I三道题-- 吾辈AC掉的是D和I两道,趁着还记得.先在这里写一写我写的两道水题D&I的解题报告吧^_^. D题的意思呢是说星云内有一堆排成一条直线的 ...
- 擦肩而过的那块牌--记ACM_ICPC西安赛区现场赛
说了那么多次orz,这次是真的orz了.去了西安打区域赛,也想过会打铁.但当终于那一刻确定打铁了之后.心里还是非常不开心的,颁奖的时候思考熊那家伙嚣张的举起来手中那个金杯,说实话闪到我眼了(太亮了QA ...
- ACM总结——2017ACM-ICPC北京赛区现场赛总结
现在距离比赛结束已经过了一个多星期了,也是终于有时间写下心得了.回来就是被压着做项目,也是够够的. 这次比赛一样是我和两个学弟(虽然是学弟,但我的实力才是最弱的T_T)一起参加的,成绩的话打铁,算是情 ...
- ACM-ICPC 2017 西安赛区现场赛 K. LOVER II && LibreOJ#6062. 「2017 山东一轮集训 Day2」Pair(线段树)
题目链接:西安:https://nanti.jisuanke.com/t/20759 (计蒜客的数据应该有误,题目和 LOJ 的大同小异,题解以 LOJ 为准) LOJ:https://l ...
- ZOJ Goldbach 2013年长沙赛区网络赛
迟到了一天的AC.... 思路: 先把单个素数 或着 两个素数能组成的情况预处理一下,然后对于给出的 n,拿第三个素数去和两个素数的情况匹配,最后要注意去重. 详情见代码. 因为手残少敲了一个 els ...
- 2014年亚洲区域赛北京赛区现场赛A,D,H,I,K题解(hdu5112,5115,5119,5220,5122)
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud 下午在HDU上打了一下今年北京区域赛的重现,过了5题,看来单挑只能拿拿铜牌,呜呜. ...
随机推荐
- 数据结构算法C语言实现(一)---2.2线性表的顺序表示和实现
注意: 虽然是用C语言实现,但是考虑到使用了一个C++的特性----引用以简化代码,所以所有的代码均以cpp作为后缀,用g++编译(以后不做说明). g++版本: 一.简述 本节主要讲述线性表的顺序实 ...
- python——复制目录结构小脚本
引言 有个需要,需要把某个目录下的目录结构进行复制,不要文件,当目录结构很少的时候可以手工去建立,当目录结构复杂,目录层次很深,目录很多的时候,这个时候要是还是手动去建立的话,实在不是一种好的方法,弄 ...
- 通过broadcastreceiver 监听短信问题
在mainfest中 订阅 短信到来的广播时候 发现找不到 <action android:name="android.provider.Telephony.SMS_RECEIV ...
- JSP内置对象-request
JSP内置对象即无需声明就可以直接使用的对象实例,在实际的开发过程中,比较常用的JSP对象有request,response,session,out和application等,笔者在本文章中将简单介绍 ...
- Android之Proguard语法
-include {filename} 从给定的文件中读取配置参数 -basedirectory {directoryname} 指定基础目录为以后相对的档案名称 -injars {class_pat ...
- 解决git pull 命令失效,不能从远程服务器上拉取代码问题
用时候在用Git pull命令的时候不管用,拉取不下来远程分支上的代码,是因为本地分支和远程分支没有建立关联. 处理这种问题很简单就按照提示执行命令即可:git branch --set-upstre ...
- sphinx :undefined reference to `libiconv' 报错解决办法
sphinx :undefined reference to `libiconv' 报错解决办法 2013-11-30 21:45:39 安装sphinx时不停报错...郁闷在make时报错,错误 ...
- MONO加载DLL调试命令
http://www.mono-project.com/docs/advanced/pinvoke/dllnotfoundexception/ http://www.mono-project.com/ ...
- ecshop 订单-》订单状态
/** * 取得状态列表 * @param string $type 类型:all | order | shipping | payment */ function get_status_list($ ...
- HTML5 常用的结构化标签整理
一.语义化结构化标签 结构化标签优点: 1.方便浏览器处理和识别,提升了网页的质量和语义. 2.减少了大量无意义的div标签,增强代码的可读性. 结构化标签:(header,nav,body,arti ...