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:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.5, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.