A - Play the Dice
时间限制: | 2000 MS |
内存限制: | 65535 MB |
问题描述
There is a dice with N sides, which are numbered from 1,2,...,n and have the equal possibility to show up when one rolls a dice. Each side has an integer Ai on it. Now here is a game that you can roll this dice once, if the i-th side is up, you will get Ai yuan. What's more, some sids of this dice are colored with a special different color. If you turn this side up, you will get once more chance to roll the dice. When you roll the dice for the second time, you still have the opportunity to win money and rolling chance. Now you need to calculate the expectations of money that we get after playing the game once.
输入说明
Input consists of multiple cases. Each case includes two lines. End with EOF.
The first line is an integer N (2<=N<=200), following with N integers Ai(0<=Ai<200)
The second line is an integer M (0<=M<=N), following with m integers Bi(1<=Bi<=n), which are the numbers of the special sides to get another more chance.
The first line is an integer N (2<=N<=200), following with N integers Ai(0<=Ai<200)
The second line is an integer M (0<=M<=N), following with m integers Bi(1<=Bi<=n), which are the numbers of the special sides to get another more chance.
输出说明
Just a real number which is the expectations of the money one can get, rounded to exact two digits. If you can get unlimited money, print "inf" a line without double quotes.
输入样例
6 1 2 3 4 5 6 0 4 0 0 0 0 1 3
输出样例
3.50 0.00
#include<iostream> #include<cstdio> #include<cstring> using namespace std; int n,m; int main(){ //freopen("input.txt","r",stdin); while(~scanf("%d",&n)){ int sum=0,a,b; for(int i=0;i<n;i++){ scanf("%d",&a); sum+=a; } scanf("%d",&m); for(int i=0;i<m;i++) scanf("%d",&b); if(sum==0) printf("0.00\n"); else if(n==m) printf("inf\n"); else printf("%.2lf\n",sum*1.0/(n-m)); } return 0; }
相关推荐
微信小程序-骰子游戏dice-game-master.zip
edwinbosire-World-Travel-Adice-f322e36.7z
Rolling-a-Dice
npm install roll-a-dice var rad = require('roll-a-dice'); var dice = new rad(); dice.roll(); //Random output dice.cheat(5).roll(); //5 dice.roll(); // Still 5 dice.fair().roll(); //Random numer 享受...
level-0-module-3-dice20:GitHub Classroom创建的level-0-module-3-dice20
克隆存储库: git clone https://github.com/JrSchmidtt/simple-rpg-dice-discord 安装以运行 安装进行编辑 安装以运行 在Visual Studio中打开Powershell终端,然后在具有bot的文件夹中运行命令```node.`'' 贡献 !...
java-ddd-demo-dice
本资源包含基于Matlab的使用dice相似系数方法进行图像分割精度验证源码和图片素材。 包含 实例1:计算二值分割图像的dice相似系数 实例2:计算多区域分割图像的dice相似系数 本资源配套CSDN博客“Matlab图像分割---...
简单的骰子应用程序。 在项目目录中,可以运行: npm start 在开发模式下运行应用程序。 打开在浏览器中查看它。
$ python -m dice 3d6 命令行参数如下: -m --min Make all rolls the lowest possible result -M --max Make all rolls the highest possible result -h --help Show this help text -v --verbose Show additional...
nodebb-plugin-dice-bot 用于通过机器人掷骰子的 NodeBB 插件。设置安装并启用插件在系统上为骰子机器人创建一个新用户。 给它取任何你喜欢的名字并将头像更改为你喜欢的任何东西。 转到 ACP 并找到 Dice Bot 的设置...
Arduino电子骰子Ardu骰子 Arduino electro说,ArduDice。
Mirai-rulateday-dice 本项目是Mirai-Console的插件项目 Mirai-rulateday-dice插件是实现TRPG骰子系统。 骰子核心逻辑处理方法项目请移步至另一个项目 trpg-java-dice.该项目主要作为集成Mirai-Console的调用方法...
概括Clova扩展的REST API服务器源代码称为“ Play Dice”。 要查看“玩骰子”扩展程序是如何工作的,请尝试在Clova应用程序或Clova扬声器(WAVE,Friens)中说“开始玩骰子”。 执行扩展时,将报告掷出骰子的结果值...
在图标上滚动骰子
DICE-5210k用户手册20100606
SWRPG-Web-Dice-Roller SWRPG的Web应用程序伴侣 #安装和设置 首先,您需要在计算机上安装NodeJS。 您可以在找到最新版本 点击此页面顶部的“克隆或下载”。 单击“下载Zip”并解压缩文件。 下一步[在此处]为...
在分离模式下(推荐) docker run -d --rm --name dice-bot-running dice-bot 停止docker实例 docker stop dice-bot-running 用法 接受'作为输入 可以用roll或r调用bot 任何类型的``r d20''辊1模具 使用修饰符```...
掷骰子学校项目,自我解释劳斯骰子
FFGNDS-Discord-Dice-Roller 学分:Vampwood负责构思客户,SkyJedi负责该项目。 《星际大战》的Discord Bot伴侣:《帝国边缘》(SW:EotE),《反叛时代》(AoR)和《部队与命运》(FnD)RPG以及Genesys,以及《五环...