ZOJ 3735 Josephina and RPG (dp)
来源:互联网 发布:网络运营部职责 编辑:程序博客网 时间:2024/05/16 19:48
这题应该是动态规划吧,乱猜的。
dp[i][j]表示 开始的时候选择第i个人。后来经过战斗&交换变成第j个人。的最优值。
#pragma comment(linker, "/STACK:1024000000,1024000000")#include <cstdio>#include <cmath>#include <cstring>#include <iostream>#include <queue>#include <map>#include <stack>#include <string>#include <algorithm>#include <vector>#include <list>#include <deque>#define LL long long#define DB double#define SI(a) scanf("%d",&a)#define SD(a) scanf("%lf",&a)#define SS(a) scanf("%s",a)#define PF printf#define MM(a,b) memset(a,b,sizeof(a))#define REP(i,a,b) for(int i=a;i<b;i++) #define REPD(i,a,b) for(int i=a;i>b;i--)#define INF 0x3f3f3f3f#define EPS 1e-8#define bug puts("bug")using namespace std;#define N 129DB re[N][N];DB dp[N][N];int n,m;int main(){ #ifndef ONLINE_JUDGE freopen("in.txt","r",stdin); #endif int a; while(~SI(n)) { n = n*(n-1)*(n-2)/6; REP(i,0,n) REP(j,0,n) SD(re[i][j]); SI(m); REP(i,0,n) REP(j,0,n) dp[i][j] = -1; REP(i,0,n) dp[i][i] = 1; while(m--) { SI(a); DB tmp = -1; REP(i,0,n) { tmp = -1; REP(j,0,n) if(dp[i][j]>=0) { tmp = max(tmp,dp[i][j]=dp[i][j]*re[j][a]); } dp[i][a] = tmp; } } DB ans = -1; REP(i,0,n) ans = max(ans,dp[i][a]); PF("%.7lf\n",ans); } return 0;}
- ZOJ 3735 Josephina and RPG (dp)
- ZOJ 3735 Josephina and RPG DP
- ZOJ 3735 Josephina and RPG DP
- ZOJ 3735 Josephina and RPG (概率DP)
- zoj-3735 Josephina and RPG[概率dp]
- ZOJ 3735 Josephina and RPG
- ZOJ 3735——Josephina and RPG(dp)
- ZOJ 3735 Josephina and RPG 概率dp水题。
- zoj 3735 Josephina and RPG(2013 长沙现场赛)
- HDU 4800 & ZJU 3735 Josephina and RPG(dp)
- ZOJ3735 Josephina and RPG(简单DP)
- HDU - 4800 Josephina and RPG(dp)
- hdu 4800 Josephina and RPG(dp)
- hdu4800 Josephina and RPG(概率dp)
- zoj 3735 Josephina and RPG (2013 亚洲区域赛 长沙站 J)
- UVALive 6620 Josephina and RPG(概率DP)
- hdu 4800 Josephina and RPG (概率dp)
- hdu 4800 Josephina and RPG dp
- LeetCode 3Sum 三个数和为零的集合 C++完整程序
- C++Primer笔记
- WPF之检测鼠标位置
- java学习06-静态static 与JVM内存分配
- The 2013 ACM-ICPC Asia Changsha Regional Contest KPocket Cube
- ZOJ 3735 Josephina and RPG (dp)
- jQuery Mobile 入门教程
- vb.net中的自定义事件
- XCLNetSearch2.0(ASP.NET通用查询控件)发布啦
- 网页中加入百度地图(带地区搜索)
- 快速计算log2()
- Listener的使用(监听ServletContext范围内属性的改变)
- UVA - 11300 Spreading the Wealth
- [ACM - 动规]数塔