All submissions for this problem are available.
A fraction is called a 'GHAINT FRACTION' if it satisfies the following conditions-
1) The sum of numerator and denominator when divided by 7 leaves remainder 5
2)The absolute value of difference of numerator and denominator is a prime number
3)Numerator raised to power denominator is less than the factorial of the greater of numerator and denominator.
If the above three conditions are satisfied then the output should be "Ghaint Fraction" else the output should be "Jaali fraction".
- The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
- Each test case contains 2 space-separated integers n denoting numerator and d denoting denominator
- For each test case, output a single line containing GHAINT FRACTION or JAALI FRACTION.
- 1 ≤ T ≤ 100
- 1 ≤ n,d ≤ 1000
Input: 3 1 4 5 8 34 789 Output: Ghaint Fraction Jaali Fraction Jaali Fraction
Example case 1. 1,4
|1-4|=3 which is prime
1 raised to power 4 is 1 which is less than 4!
As all the three conditions are satisfied so the output is GHAINT FRACTION
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.