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题,看来单挑只能拿拿铜牌,呜呜. ...
随机推荐
- python序列化模块json和pickle
序列化相关 1. json 应用场景: json模块主要用于处理json格式的数据,可以将json格式的数据转化为python的字典,便于python处理,同时也可以将python的字典或列表等对象转 ...
- 基本概率分布Basic Concept of Probability Distributions 4: Negative Binomial Distribution
PDF version PMF Suppose there is a sequence of independent Bernoulli trials, each trial having two p ...
- 系统安装之:虚拟机VMware V12.0.1 专业版 + 永久密钥
撰写日期:2016-6-30 10:30:26 转自:http://blog.sina.com.cn/s/blog_4549d6770102vxue.html VMware V12.0.1 专业 ...
- 解决Cookie乱码问题
写了一个cookie的定义和获取,结果我输入中文后,页面报错 报错信息如下: type Exception report message An exception occurred processin ...
- 【Alpha阶段】第7.5次Scrum例会
会议信息 时间:2016.10.31 21:30 时长:10min 地点:大运村1号公寓5楼楼道 类型:日常Scrum会议 NXT:2016.11.01 21:30 个人任务报告 姓名 今日已完成Is ...
- Git更新到最新版本
添加git的ppa源sudo apt-add-repository ppa:git-core/ppasudo apt-get updatesudo apt-get upgrade
- Python: sort,sorted,OrderedDict的用法
Python: sort,sorted,OrderedDict的用法 from http://stqdd.com/archives/427 by 莫亚菜 python对容器内数据的排序有两种,一种是容 ...
- spring--aop总结
AOP(Aspect Oriented Programming的缩写)所用的思想其实和设计模式是一样的,即在不修改原代码的情况下统一增加或者修改功能.还有,AOP大多用在spring里面. AOP是面 ...
- VIM for Python and Django Development
VIM for Python and Django Development VIM-PyDjango created by Programmer for Programmer who work on ...
- 自然语言15_Part of Speech Tagging with NLTK
https://www.pythonprogramming.net/part-of-speech-tagging-nltk-tutorial/?completed=/stemming-nltk-tut ...