Submit | All submissions | Best solutions | Back to list |
Problem hidden on 2013-03-17 09:56:26 by Francky
DAB - DAB Loves Sweets |
Dab is a petty thief with a sweet tooth. One fine day Dab was caught stealing traditional Indian sweets from Pattanaik sweet corner. Being a lazy lad, Dab was immediately caught and forced to reveal what sweet he had. Now there are n boxes numbered 1 to n each containing three type of sweets i.e Gulab Jamun, Rasgulla and ladoo.
Given that Dab had stuffed his mouth with a sweet "X" find the probability that he stole from the kth box.
Input
First line contains T the number of test cases.
Each test case contains the value of n(the number of boxes). The following n lines contains three integers each. Each of which denote the number of ladoos, Gulab Jamun and Rasgulla in each box respectively.
The (n+1) th line of each test case contains the value of k followed by character 'L' or 'G' or 'R' where 'L' denotes a ladoo, 'G' denotes a gulab jamun, 'R' denotes a Rasgulla.
Output
For each test case output the probability that dab stole from the kth box. Print the value rounded off to 9 decimal places.
Example
Input: 1 3 5 5 5 3 4 5 2 4 5 2 L Output: 0.326732673
Constraints:
1<=t<=20
1<=n<200
1<=k<=n
1<= number of each type of sweet <200
Added by: | Rishikesh Jha |
Date: | 2013-03-11 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Own |
hide comments
2013-03-17 08:55:51 Francky
(ter) The input is still badly formated. It's a problem for python users. I would like to see this fixed. Please. It will be un-hidden when fixed. |
|
2013-03-17 08:36:57 mystique_blue
@Rohit use double. :). I thought it was a classical prob... but its ok in the tutorial section. Last edit: 2013-03-17 08:38:13 |
|
2013-03-15 05:09:13 Amit Jain
dont know what is going on here..%1.9lf was giving wrong answer and %.9lf is accepted |
|
2013-03-14 19:31:00 Francky
(bis) The input is still badly formated. It's a problem for python users. I would like to see this fixed. Should I hide the problem until this ? I hope not. |
|
2013-03-14 17:40:41 rohit ajmera
don't know why the last 3 digits are wrong using float ?? |
|
2013-03-14 09:12:10 Ouditchya Sinha
Nice but easy problem... :) |
|
2013-03-12 13:17:10 Francky
There is a problem with input formating, reading it with python shows that, please fix the input file as in the description. Thanks for that. My (dummy) python code get NZEC, although it should only have WA, as it only reads the input! I got AC with tortured input method, please fix it soon for other users. Moreover, I too think it's not a coding problem but only a simple mathematical one... Last edit: 2013-03-12 16:33:34 |
|
2013-03-11 16:12:18 Vipul Pandey
Just basic probability! |
|
2013-03-11 10:42:19 Kevin Sebastian
range of n? Constraints Added. Last edit: 2013-03-11 10:40:03 |