2013长沙现场赛J - Josephina and RPG

icpc2013长沙区域赛 文章目录icpc2013长沙区域赛A.Alice's Print ServiceC.CollisionG.Graph ReconstructionH.SkycityI.LIKE vs CANDLEJ.Josephina and RPGK.Pocket Cube icpc2013长沙区域赛 A.Alice’s Print Service 题意: 现在你要打印一些东西,比如需要99张纸,打印100张以下时话费10元每张,100张及100张以上时需要5元每张,此时你可以选择打印100张,使得花费更小。现给一个数字 阅读详情



题意:给你各个队伍对战的胜率表,然后给你要按顺序挑战的队伍,问全胜的最大胜率是多少。这道题的难点在于,获胜的时候可以选择更换队伍,也可以不更换队伍,一开始你可以选择任意队伍。

思路:这道题是一道简单的dp题目,每次只有C(m,3)种状态,每种状态表示当前队伍是哪个,我们用now数组来表示,然后每次有两种选择,更换队伍或不更换队伍。不更换队伍很明显就是now[j] *= t[j][x[i]];更换队伍的是用前一个状态中的最大值去乘t[x[i - 1]][x[i]],能理解的话基本上这道题就完了。下面给代码。

#include<iostream>   
#include<cstring>  
#include<cstdio> 
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<set>
using namespace std;
#define maxn 10005
#define xx 1000000001
double t[1005][1005], now[1005];
int main() {
	int m;
	int a[15];
	a[0] = 1;
	a[1] = 1;
	for (int i = 2; i <= 10; i++) {
		a[i] = a[i - 1] * i;
	}
	while (scanf("%d", &m) != EOF) {
		int r = a[m] / a[m - 3] / 6;
		for (int i = 0; i < r; i++) {
			for (int j = 0; j < r; j++) {
				scanf("%lf", &t[i][j]);
			}
		}
		int n;
		int x[maxn];
		for (int i = 0; i < r; i++) {
			now[i] = 1;
		}
		scanf("%d", &n);
		scanf("%d", &x[0]);
		for (int j = 0; j < r; j++) {
			now[j] *= t[j][x[0]];
		}
		for (int i = 1; i < n; i++) {
			scanf("%d", &x[i]);
			double maxnum = 0;
			for (int j = 0; j < r; j++) {
				maxnum = max(now[j], maxnum);
				if (j != x[i - 1]) {
					now[j] *= t[j][x[i]];
				}
			}
			now[x[i - 1]] = maxnum*t[x[i - 1]][x[i]];
		}
		double maxnum = 0;
		for (int i = 0; i < r; i++) {
			maxnum = max(maxnum, now[i]);
		}
		printf("%.6lf\n", maxnum);
	}
}


【RL+空战】学习记录01:jsbsim 仿真环境初次学习,F16 战机起飞 【代码】【RL+空战】学习记录01:jsbsim 仿真环境初次学习,F16 战机起飞。 阅读详情

相关推荐

VScode利用EIDE和cortex-debug进行stm32开发(也适用51)

你是否因为keil页面太丑而烦恼,你是否因为keil编译太慢而恼怒,ok阿,今天也是给大家带来怎么在vscode上进行stm32的编程(我不会告诉你,我搞了好几天才搞好的💔💔💔)为什么是简单介绍?因为太啰嗦了,我嫌麻烦😋,大家可以去EIDE的官方文档去看。

weixin_73952614的博客 9395

2013长沙赛区现场赛 J - Josephina and RPG

J -Josephina and RPG Time Limit:2000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64u SubmitStatusPracticeHDU 4800 Description A role-playing game (RPG and sometimes ...

weixin_34112208的博客 133

prometheus 从入门到精通(史上最全)

Prometheus(由go语言开发)是一套开源的监控&报警&时间序列(按照时间排序)数据库的组合。因为kubernetes(俗称k8s)的流行带动了prometheus的发展。它可以监控主机,服务,容器,支持多种exporter采集数据,还支持pushgateway进行数据上报,Prometheus性能足够支撑上万台规模的集群。原文链接:https://blog.youkuaiyun.com/qq_45277554/article/details/130917620时间序列数据。

流水_鱼鱼的博客 1万+

HDU 4800/zoj 3735 Josephina and RPG 2013 长沙现场赛J题

第一年参加现场赛,比赛的时候就A了这一道,基本全场都A的签到题竟然A不出来,结果题目重现的时候1A,好受打击 ORZ..... 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4800 题目大意:给定C(3,N)支队伍之间对战的获胜概率,再给定一个序列存放队伍编号,每次获胜之后可以选择和当前战胜的对手换队伍。问按给定序列依次挑战全部胜利的最大概率。...

weixin_34209406的博客 152

iTunes备份文件路径修改方法

因为以前的很多帖子iTunes都不是从微软下载的,而现在的iTunes一般都是微软商店里面的,它的路径为:“C:\Users\ 你的用户名 \Apple\MobileSync” (注:用户名,根据个人电脑名称更改)打开iTunes备份路径:“C:\Users\txh\AppData\Roaming\Apple Computer\MobileSync”,其中文件夹MobileSync就是用来存放备份文件的。创建你想备份纯在的目录创建备份文件目录(我的是G:/APPLE/Backup)2.粘贴的剪切文件目录。

尘玥的故事 1万+

ROS2实战:打造智能巡检机器人的关键技术与实现

本文详细介绍了基于ROS2和Navigation2构建智能巡检机器人的完整实战流程。通过设计主从协作的事件驱动架构,实现了机器人在已知地图中的自动导航、定点语音播报和环境图像采集功能。文章涵盖了从环境搭建、仿真配置到核心控制节点、语音服务与图像记录模块的代码实现,为开发者打造实用的自动巡检机器人提供了清晰的技术指南。

weixin_29031057的博客 225

zoj 3735 Josephina and RPG (2013 亚洲区域赛 长沙站 J)

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3735  Josephina and RPG Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge A role-playing game (RPG and so

ddyyxx的程序员之路 1万+

stackelberg博弈_博弈论、多智能体、强化学习(随便记点东西)

多智能体应用场景:已实现:游戏AI。正在努力:UAV,物资运输,快递分发,交通系统。未来:社会学,预测群体行为,城市区域合作,国际关系。博弈论基本定义:玩家集合: 策略集合: 收益函数: 囚徒困境:两智能体矩阵博弈坦白抵赖坦白1,13,0抵赖0,32,2占优策略与最佳应对:上表中两者均具有占优策略,即无论如何都应该选坦白。那么构造下表。坦白抵赖坦白1,13,0抵赖0,12,2对于玩家一来说,坦白...

weixin_39611722的博客 2998

zoj 3735 Josephina and RPG(2013 长沙现场赛)

Josephina and RPG Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge A role-playing game (RPG and sometimes roleplaying game) is a game in which players assume the roles of cha

ACway的专栏 5044

小龙虾OpenClaw卸载全攻略,彻底清理缓存和配置,干净无残留!

不想要的小龙虾OpenClaw怎么彻底卸载?🦞本文教你如何彻底的卸载OpenClaw⚡️,Windows/macOS/Linux通用,干净无残留🧹

XiaoqiangClub的博客 314

企业数字化转型解决方案架构设计:一个五维全景视角

本文系统探讨了企业数字化转型的架构设计框架,提出五维协同模型:企业架构作为战略罗盘,业务架构聚焦价值创造,应用架构实现能力载体,数据架构提供智能燃料,技术架构奠定基础支撑。文章深入分析了各架构域的核心要素、设计原则及相互关系,并指出数字化转型需通过渐进路径,结合战略引领、技术赋能和组织变革,构建有机统一的架构体系。该框架为企业应对数字化复杂性提供了系统性方法论,强调从整体视角实现技术与业务的深度融合。

金牌架构师 1256

Josephina and RPG(2013长沙赛区)

这个dp 也经常见的。 只不过自己想错l

Shimmer_的专栏 1056

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

ZOJ 3735 Josephina and RPG DP

给出一个C(3,m)*C(3,m)的矩阵ko,ko[i][j]表示第i个组合打败第j个组合的概率,开始的时候我方可以任意选择一种如何,并且在战斗中,每击败对手一个组合,就可以将我方现在的组合变换成对手被击败的那种组合。接下来给出n个对手的组合,问我方怎么选择,可以使的按给定的顺序打败对手所有的组合的概率最大。       用dp【j】【i】表示击败对手第i个组合时,我方的组合是j,对于dp[j]

Broken Wings 2211

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

ACM 2013 长沙区域赛 Josephina and RPG (概率dp)

ZOJ - 3735    题目大意:        游戏共有m个角色,3个角色组成一个战队,有个战队,i战队打败j战队的概率为p[i][j].游戏有n轮,每轮对方都会有一个战队与你对战,游戏开始时你可以选择任意一个战队进行游戏,每轮结束后如果你胜出,可以进行下一轮,并且可以把自己使用的战队更换为刚打败的战队,求通关的最大胜率。 题解: dp[i][j]代表是对战前i个队伍后且当前的...

hxxjxw的博客 270

2013 ACM-ICPC 长沙赛区 部分分析

A hdu 4791  Alice's Print Service 需要在纸上计算发现一个事实,只会取一种价格的纸。 然后就很容易编码了,注意爆32位的细节。 /* author:ray007great version:1.0 */ #include #include #include #include #include #include #include #includ

lost@hdu 1530

2016 ICPC青岛赛 hdu5984 C Pocky

Pocky Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 156    Accepted Submission(s): 68 Problem Description Let’s talking about som

overload1997 2855

2017 icpc广西邀请赛 K.Query on A Tree (hdu 6191)可持久化字典树

Query on A Tree Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 132768/132768 K (Java/Others) Total Submission(s): 0    Accepted Submission(s): 0 Problem Description Monkey A liv

overload1997 1294

2012杭州赛区(浙江理工大学)J - Scaring the Birds

J - Scaring the Birds Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Description It’s harvest season now!  Farmer John plants a lot of co

overload1997 1263

2017 ACM-ICPC 亚洲区(西安赛区)网络赛 G Xor lca+暴力

题目链接:https://nanti.jisuanke.com/t/17120 题意:给你一棵树,每个点都有权值,q次询问,每次询问给你a,b,k,问从点a到点b每隔k步的异或和是多少。 思路:现场没敢打,复杂度怎么算都不对。。。后来别人说可以1的情况lca其他暴力,我就试了一下,一开始是TLE,然后我各种迷之优化确实可以过。。。。走k步这里我是用了倍增的数组然后用logk的复杂度走k步。。。

overload1997 1164

2016 ICPC青岛赛 hdu5988 G.Coding Contest

Coding Contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 849    Accepted Submission(s): 156 Problem Description A coding cont

overload1997 949

2016 ICPC大连赛区 hdu5978 To begin or not to begin

To begin or not to begin Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 229    Accepted Submission(s): 175 Problem Description A b

overload1997 935

2012杭州赛区(浙江理工大学)H - Friend Chains

H - Friend Chains Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4460 Description For a group of people, there is an idea t

overload1997 774

2016 ICPC大连赛区 hdu5976 Detachment

Detachment Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 437    Accepted Submission(s): 144 Problem Description In a highly devel

overload1997 719

2015CCPC南阳场 H - Sudoku

比赛的时候都错了题意我去。。一直TLE+WA.. 赛后看了题解才知道都错了题意。。愧疚啊我去。。这次比赛我读的两道题都读错了题意,坑死队友。。 H - Sudoku Time Limit:1000MS     Memory Limit:65535KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU

overload1997 676

2012杭州赛区(浙江理工大学)C - Substrings

C - Substrings Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4455 Description XXX has an array of length n. XXX wants to kno

overload1997 654

2016 ICPC大连赛区 hdu5974 Convex

Convex Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 170    Accepted Submission(s): 145 Problem Description We have a special con

overload1997 570
上一篇: 2013长沙现场赛C - Collision
下一篇: hdu1532 Drainage Ditches (网络流入门)&(EK算法模板)
overload1997
博客等级 码龄11年 328粉丝 210原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值