rs
BAN USER- 0of 0 votes
AnswersRandom number generator
- rs in United States
There is an ideal random number generator, which given a positive integer M can generate any real number between 0 to M with equal probability.
Suppose we generate 2 numbers x and y via the generator by giving it 2 positive intergers A and B, what's the probability that x + y is less than C? where C is a positive integer.
Input Format
The first line of the input is an integer N, the number of test cases.
N lines follow. Each line contains 3 positive integers A, B and C.
All the integers are no larger than 10000.
Output Format
For each output, output a fraction that indicates the probability. The greatest common divisor of each pair of numerator and denominator should be 1.
Input
3
1 1 1
1 1 2
1 1 3
Output
1/2
1/1
1/1| Report Duplicate | Flag | PURGE
Software Engineer / Developer Algorithm Math & Computation
if I consider c/c++ as the source language, every time we compile the source code, the compiler is also configured to generate the map file. With the information about stack/heap expansion. It is located from there. There is nothing trivial in that. If you find anything suspicious, comments are welcome.
- rs November 18, 2012Second thing, if I have the source code. It can be easily seen that if the variable is allocated dynamically its from heap, if the variable is global and initialized it goes to Data Section. if its static, global uninitialized then its goes to BSS, if the variable is part of any function and memory has not allocated dynamically, its goes to stack.