Submit | All submissions | Best solutions | Back to list |
BEMINE - Bermuda Love Triangle |
Bermuda triangle is also known as Devil's triangle. Many people disappeared there with their ships or planes. Love triangle is a triangle where when someone gets into its uncertainty he disappears from himself. So Bermuda love triangle is a triangle where there is uncertainty from each angle. Here is a story of Bermuda love triangle, where 3 vertex consists of 2 girls and a boy. Both of the girls love the boy and they are best friends also. The boy feels same for the both girls. So, its a uncertainty-uncertainty-uncertainty triangle. As this can't go like this, they all want a solution. As students of CS department they found a solution.
The boy will be holding two infinite series in two hands, the first girl will pick a series, the 2nd girl gets the other. Then the 2nd girl will tell a number x where both sequence will end. Now, whose result of the series will have a larger prime divisor will get the boy. If the result for both series is equal then they will all be friends.
Given the series, first girl's choice, second girl's chosen x, find who will win the boy, or they will be friends.
Series 1 = 1 + 2 + 3 + 4 + 5 + 6 + ... + x
Series 2 = 0! + 1*1! + 2*2! + 3*3! + 4*4! + ... + x*x!
Use faster I/O.
Input
The first line contains an integer 0 < t < 10000, number of testcases.
Next t lines contain 2 integer 1 <= s <= 2 and 2 <= x <= 108. Here s is the choice of the first girl, and x is the end of the series.
Output
For each test case print "First" if the first girl wins the boy, print "Second" if the second one wins, "Friends" otherwise.
Example
Input: 4 1 2 2 50 2 36 1 20 Output: Friends First Friends Second
Added by: | Safayet |
Date: | 2018-11-17 |
Time limit: | 1s-2s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
hide comments
2018-11-29 10:19:17 Vipul Srivastava
Thanks for the reply nadstratosfer. It clarified some serious misunderstanding I had regarding the problem. |
|
2018-11-29 04:33:56
Vipul, s1[36] = 666 = 2 * 3^2 * 37 s2[36] = 13763753091226345046315979581580902400000000 = 2^34 * 3^17 * 5^8 * 7^5 * 11^3 * 13^2 * 17^2 * 19 * 23 * 29 * 31 * 37 |
|
2018-11-27 18:33:32 Vipul Srivastava
How are the largest prime divisors in case of 36 same? |