1200: Choosy in Food

Time Limit: 1 Sec  Memory Limit: 1280 MB
Submit: 32  Solved: 5
[Submit][Status][Web Board]

Description

Xiao Ming find n trees (labeled 0...n-1) which join a circle in a magical land. Each tree
is covered with ripe berries. Xiao Ming wants to find the tree whose berries are most delicious. He starts from the tree X, walks clockwise to find the target. Each time the probability of him walking k trees is Pk% . P1+P2+..+Pk = 100

Now we know the target of Xiao Ming is the tree Y. Require to know expectation of the number of the trees which Xiao Ming walk through

Input

The first parameter is T, indicates the case number.

In each case, there are four integers at the first line, N, M, X , Y (Tree labels from 0 to N-1, N < 100, M < N).

Output

The expectation of the number of trees Xiao Ming walk through. It will be reserved two decimal places. If Xiao Ming will never arrive the tree, output -1.

Sample Input

2
4 2 0 1
50 50
4 1 0 2
100

Sample Output

4.20
2.00

HINT

hzau 1200 Choosy in Food的更多相关文章

  1. C语言 · 打印1-200之间的素数

    素数定义:除了1和本身再无其他整数可被其本身整除的数称为素数,也称质数. 举一例子打印出1-200之间所有的素数: #include<stdio.h> #include<math.h ...

  2. POJ 1200 字符串HASH

    题目链接:http://poj.org/problem?id=1200 题意:给定一个字符串,字符串只有NC个不同的字符,问这个字符串所有长度为N的子串有多少个不相同. 思路:字符串HASH,因为只有 ...

  3. (hzau)华中农业大学第四届程序设计大赛网络同步赛 G: Array C

    题目链接:http://acm.hzau.edu.cn/problem.php?id=18 题意是给你两个长度为n的数组,a数组相当于1到n的物品的数量,b数组相当于物品价值,而真正的价值表示是b[i ...

  4. sicily 1200欢迎提出优化方案

    水题来的……我的做法是用a[10]数组表示每个数字出现的次数. 1200. Stick 限制条件 时间限制: 1 秒, 内存限制: 32 兆 题目描述 Anthony has collected a ...

  5. bzoj 1200: [HNOI2005]木梳 DP

    1200: [HNOI2005]木梳 Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 266  Solved: 125[Submit][Status] ...

  6. BZOJ 1200 木梳

    Description Input 第一行为整数L,其中4≤L≤100000,且有50%的数据满足L≤104,表示木板下侧直线段的长.第二行为L个正整数A1,A2,…,AL,其中Ai≤108 Outp ...

  7. Stitch Fix 融资1200万美元,又一个时尚创业的哈佛女MBA |华丽志

    Stitch Fix 融资1200万美元,又一个时尚创业的哈佛女MBA |华丽志 Stitch Fix 融资1200万美元,又一个时尚创业的哈佛女MBA

  8. [NOIP2012提高组] CODEVS 1200 同余方程(扩展欧几里德算法)

    数论题..所有数论对我来说都很恶心..不想再说什么了.. ------------------------------------------------ #include<iostream&g ...

  9. poj 1200 Crazy Search(hash)

    题目链接:http://poj.org/problem?id=1200 思路分析:从数据来看,该题目使用线性时间算法,可见子串的比较是不可能的:使用hash可以在常数时间内查找,可以常数时间内判重, ...

随机推荐

  1. Selenium chrome配置不加载图片

    from selenium import webdriver chrome_options = webdriver.ChromeOptions() prefs = {"profile.man ...

  2. sql server2005版本中,len函数计算了字符串末尾的空格

    sql server2005版本中,len函数计算了字符串末尾的空格的长度,以下是测试脚本: print @@version declare @v varchar(max) set @v = 'hp, ...

  3. Python之匿名函数(Day18)

    匿名函数 为了解决那些功能很简单的的需求而设计的一句话函数 #这段代码 def calc(n): return n**n print(calc(10)) #换成匿名函数 calc = lambda n ...

  4. 流量分析系统---flume(测试flume+kafka)

    1.在flume官方网站下载最新的flume     wget http://124.205.69.169/files/A1540000011ED5DB/mirror.bit.edu.cn/apach ...

  5. 41和为S的连续正数序列

    题目描述 小明很喜欢数学,有一天他在做数学作业时,要求计算出9~16的和,他马上就写出了正确答案是100.但是他并不满足于此,他在想究竟有多少种连续的正数序列的和为100(至少包括两个数).没多久,他 ...

  6. $《利用Python进行数据分析》学习笔记系列——IPython

    本文主要介绍IPython这样一个交互工具的基本用法. 1. 简介 IPython是<利用Python进行数据分析>一书中主要用到的Python开发环境,简单来说是对原生python交互环 ...

  7. Django组件 用户认证,form

    auth模块 在进行用户登陆验证的时候,如果是自己写代码,就必须要先查询数据库,看用户输入的用户名是否存在于数据库中: 如果用户存在于数据库中,然后再验证用户输入的密码,这样一来就要自己编写大量的代码 ...

  8. 20165101刘天野 2017-2018-2 《Java程序设计》第6周学习总结

    #20165101刘天野 2017-2018-2 <Java程序设计>第6周学习总结 教材学习内容总结 第八章:常用实用类 String类:不可变类,一些看起来能够改变String的方法其 ...

  9. 12.常见模块time、json模块

    1.time模块 import time #python中最基本的时间模块 time.time() #时间戳 (1970年1月1日00:00:00后经过的浮点秒数) time.localtime(ti ...

  10. MATLAB常用指令记录

    help + 'command name' % 查询指令用法 Ctrl + Break % 强制终止程序运行 Shift + Enter % command window下换行不运行指令 M'; % ...