2013 Asia Changsha Regional Contest---Josephi…
2018-06-17 23:43:31来源:未知 阅读 ()
题目链接
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[1005][1005]; double d1[1005]; int a[10005]; int main() { int M,N; while(scanf("%d",&M)!=EOF) { M=M*(M-1)*(M-2)/6; for(int i=0;i<M;i++) { for(int j=0;j<M;j++) scanf("%lf",&s[i][j]); } scanf("%d",&N); for(int i=0;i<N;i++) scanf("%d",&a[i]); for(int i=0;i<M;i++) d1[i]=1.0; for(int i=0;i<N;i++) { int x=a[i]; double r=0.0; for(int j=0;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-1]]); } return 0; }
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
- The 2019 Asia Nanchang First Round Online Programming Co 2019-09-17
- NOIP 2013 花匠 神仙操作 2019-05-13
- vs2013下配置x64版c++ 2019-04-18
- Ceres配置(vs2013+Win10) 2018-11-26
- vs2013+opencv3.2配置 2018-11-26
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash