博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
UVA 10417 Gift Exchanging
阅读量:7022 次
发布时间:2019-06-28

本文共 964 字,大约阅读时间需要 3 分钟。

#include 
#include
#include
#include
#define N 12using namespace std;int n;int expect[6]; //5种礼物的实际数量double p[N][6];double first[6];void Input(){ int i,j; scanf("%d", &n); for(j=1;j<=5;j++) { scanf("%d", &expect[j]); } for(i=0;i
1e-9) { expect[i]--; t = dfs(g+1, c*p[g][i]); if(g==0) first[i]+=t; expect[i]++; ans+=t; } } return ans;}void Do(double s){ int x; double v=0; for(int i=1;i<=5;i++) { if(first[i]/expect[i]-v > 1e-9) { x=i; v=first[i]/expect[i]; } } printf("%d %.3lf\n",x,v/s);}int main(){ int t; double s; scanf("%d", &t); while(t--) { Input(); s=dfs(0, 1); Do(s); } return 0;}

 

转载于:https://www.cnblogs.com/tuty/p/4856635.html

你可能感兴趣的文章
Hash
查看>>
nginx 配置手机端PC端访问不同的项目
查看>>
SpriteKit-(SKNode)
查看>>
并发编程可能存在的问题
查看>>
c++ 不太懂得地方
查看>>
前端面试问题整理 第一部分
查看>>
挖一口自己的井
查看>>
[Dart] Flutter 上传文件
查看>>
XML概述
查看>>
leetcode-598-Range Addition II
查看>>
springboot + shiro 验证码与记住登录
查看>>
小猿圈分享HTML5中form如何关闭自动完成功能的方法
查看>>
Carthage 安装与使用
查看>>
详解 Cookie,Session,Token
查看>>
jq 登录正则验证
查看>>
TCP之三次握手和四次挥手
查看>>
【算法学习笔记】70.回文序列 动态规划 SJTU OJ 1066 小M家的牛们
查看>>
phpcms v9 评论的bug.
查看>>
使用Jmeter进行APP接口测试经验总结
查看>>
微信智能硬件应用——微信插座控制
查看>>