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. python实现复制整个目录的方法

    import shutil #复制文件 shutil.copyfile('listfile.py', 'd:/test.py') #复制目录 shutil.copytree('d:/temp', 'c ...

  2. STL中的二分查找——lower_bound 、upper_bound 、binary_search

    STL中的二分查找函数 1.lower_bound函数 在一个非递减序列的前闭后开区间[first,last)中.进行二分查找查找某一元素val.函数lower_bound()返回大于或等于val的第 ...

  3. hbase shell编码显示中文

    最近测试hbase shell,碰到个中文显示编码问题,最后通过Python解决了问题,具体操作如下: hbase(main):015:0* scan 'fr_test_hbase:test_log1 ...

  4. 使用Kotlin开发Android应用(III):扩展函数和默认值

    通过前面两篇文章,我们学习了Kotlin的基本知识,并知道如何配置工程,本文将接着介绍Java没有的而Kotlin实现了的有趣的特性.记住当你对Kotlin语言有任何疑问时,请参考官方指南.该指南组织 ...

  5. 【整理学习Hadoop】H D F S 一个分布式文件系统

    Hadoop分布式文件系统(HDFS)被设计成适合运行在通用硬件(commodity hardware)上的分布式文件系统.它和现有的分布式文件系统有很多共同点.但同时,它和其他的分布式文件系统的区别 ...

  6. NetCDF 介绍

    NetCDF 1 NetCDF 1.1概述(Overview) NetCDF (network Common Data Form) is a set of software libraries and ...

  7. springboot-项目属性配置

    springboot如何新建一个项目参考博客:https://www.cnblogs.com/junyang/p/8151802.html 在springboot默认生成的配置文件的格式是:appli ...

  8. Ubuntu 12.04下boost库的交叉编译

    oost Ver: 1.55.0Compiler : GNU gcc 4.6 for ARM 1. 确保ARM编译成功安装,并配置好环境变量.2. 解压boost压缩包 3. 进入目录执行./boot ...

  9. Java中Arrays.sort()和Collections.sort()

    1.简单示例 sort方法的使用非常的简单明了,下面的例子中,先定义一个比较Dog大小的Comparator,然后将其实例对象作为参数传给sort方法,通过此示例,你应该能够快速掌握Arrays.so ...

  10. No input clusters found in output/ZS_TEST_OUTPUT3404268420/clusters-0/part-randomSeed. Check your -c argument.

    错误原因可能为: -i 后面参数路径对应的目录或文件中的数据为空,即输入集为空,所以找不到cluster