2013 Asia Changsha Regional Contest---Josephina and RPG(DP)
题目链接
http://acm.hdu.edu.cn/showproblem.php?pid=4800
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?
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cstring>
using namespace std;
typedef long long LL;
double s[][];
double d1[];
int a[]; int main()
{
int M,N;
while(scanf("%d",&M)!=EOF)
{
M=M*(M-)*(M-)/;
for(int i=;i<M;i++)
{
for(int j=;j<M;j++)
scanf("%lf",&s[i][j]);
}
scanf("%d",&N);
for(int i=;i<N;i++)
scanf("%d",&a[i]);
for(int i=;i<M;i++)
d1[i]=1.0;
for(int i=;i<N;i++)
{
int x=a[i];
double r=0.0;
for(int j=;j<M;j++)
{
d1[j]=d1[j]*s[j][x];
r=max(r,d1[j]);
}
d1[x]=max(d1[x],r);
}
printf("%.6lf\n",d1[a[N-]]);
}
return ;
}
2013 Asia Changsha Regional Contest---Josephina and RPG(DP)的更多相关文章
- The 2013 ACM-ICPC Asia Changsha Regional Contest - J
Josephina and RPG Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge A role-playin ...
- The 2013 ACM-ICPC Asia Changsha Regional Contest - K
Pocket Cube Time Limit: 2 Seconds Memory Limit: 65536 KB Pocket Cube is a 3-D combination puzzl ...
- The 2013 ACM-ICPC Asia Changsha Regional Contest - A
Alice's Print Service Time Limit: 2 Seconds Memory Limit: 65536 KB Alice is providing print ser ...
- 2013 Asia Chengdu Regional Contest
hdu 4786 Fibonacci Tree http://acm.hdu.edu.cn/showproblem.php?pid=4786 copyright@ts 算法源于ts,用最小生成树可以求 ...
- 2013 Asia Hangzhou Regional Contest
Lights Against Dudely http://acm.hdu.edu.cn/showproblem.php?pid=4770 15个位置,所以可以暴力枚举那些放,对于放的再暴力枚举哪个转, ...
- HDU4771(2013 Asia Hangzhou Regional Contest )
http://acm.hdu.edu.cn/showproblem.php?pid=4771 题目大意: 给你一幅图(N*M)“@”是起点,"#"是墙,“.”是路,然后图上有K个珠 ...
- 2013 Asia Hangzhou Regional Contest hdu4780 Candy Factory
参考:https://blog.csdn.net/sd_invol/article/details/15813671 要点 每个任务的结束时间是固定的,不受任何因素影响 机器只在最一开始有用,在那之后 ...
- zoj 3659 Conquer a New Region The 2012 ACM-ICPC Asia Changchun Regional Contest
Conquer a New Region Time Limit: 5 Seconds Memory Limit: 32768 KB The wheel of the history roll ...
- 2018 ACM-ICPC Asia Beijing Regional Contest (部分题解)
摘要 本文主要给出了2018 ACM-ICPC Asia Beijing Regional Contest的部分题解,意即熟悉区域赛题型,保持比赛感觉. Jin Yong’s Wukong Ranki ...
随机推荐
- 最新 去掉 Chrome 新标签页的8个缩略图
chrome的新标签页的8个缩略图实在让人不爽,网上找了一些去掉这个略缩图的方法,其中很多已经失效.不过其中一个插件虽然按照原来的方法已经不能用了,但是稍微变通一下仍然是可以用的(本方法于2017.1 ...
- django server之间通过remote user 相互调用
首先,场景是这样的:存在两个django web应用,并且两个应用存在一定的联系.某些情况下彼此需要获取对方的数据. 但是我们的应用肯经都会有对应的鉴权机制.不会让人家随随便便就访问的对吧.好比上车要 ...
- Python-Jenkins API使用 —— 在后端代码中操控Jenkins
最近在工作中需要用到在后台代码中触发Jenkins任务的构建,于是想到Jenkins是否有一些已经封装好的API类库提供,用于处理跟Jenkins相关的操作.下面就简单介绍下我的发现. Linux C ...
- 安卓易学,爬坑不易——腾讯老司机的RecyclerView局部刷新爬坑之路
针对手游的性能优化,腾讯WeTest平台的Cube工具提供了基本所有相关指标的检测,为手游进行最高效和准确的测试服务,不断改善玩家的体验.目前功能还在免费开放中. 点击地址:http://wetest ...
- zookeeper源码分析之六session机制
zookeeper中session意味着一个物理连接,客户端连接服务器成功之后,会发送一个连接型请求,此时就会有session 产生. session由sessionTracker产生的,sessio ...
- ASP.NET Core 中文文档 第四章 MVC(3.7 )局部视图(partial)
原文:Partial Views 作者:Steve Smith 翻译:张海龙(jiechen).刘怡(AlexLEWIS) 校对:许登洋(Seay).何镇汐.魏美娟(初见) ASP.NET Core ...
- 【HTML】Html页面跳转的5种方式
目录结构: // contents structure [-] html实现 javascript方式实现 结合了倒数的javascript实现(IE) 解决Firefox不支持innerText的问 ...
- docker4dotnet #1 – 前世今生 & 世界你好
作为一名.NET Developer,这几年看着docker的流行实在是有些眼馋.可惜的是,Docker是基于Linux环境的,眼瞧着那些 java, python, node.js, go 甚至连p ...
- linux系统oracle-ora12505问题解决方案一
说明:(1)Linux版本 Linux version 2.6.32.12-0.7-default (geeko@buildhost) (gcc version 4.3.4 [gcc-4_3-bran ...
- Linux下的C Socket编程 -- server端的继续研究
Linux下的C Socket编程(四) 延长server的生命周期 在前面的一个个例子中,server在处理完一个连接后便会立即结束掉自己,然而这种server并不科学啊,server应该是能够一直 ...