Be A Mathematician
ABHISHEK and PARTH just got into fight and they are choosing students from their section to fight against each other.
The team with higher number of students will always win.
Since they are in same section, with N students having roll number 1 to N (inclusive),they have to choose among them.
They came to an agreement that both of them will choose a number X and Y, and all the multiples of X or Y (inclusive) will be on the side of corresponding team.
If a student having roll number which is multiple of both won't join any team.
You have to determine whose team will win the fight - "ABHISHEK" or "PARTH" and also print the difference of the students, between their teams. If there is a tie, print "TIE". .
First line contains N, representing number of students in class having roll number : 1 to N.
Second line contains X and Y, representing the number chosen by ABHISHEK and PARTH correspondingly.
Print "ABHISHEK" or "PARTH" , whoever wins and the Difference in number of students (with a space in between).
In case of a tie, print "TIE".
- 1 ≤ N ≤ 10^18
- 1 ≤ X ≤ N
- 1 ≤ Y ≤ N
Input: 30 4 6 Output: ABHISHEK 2
Input: 30 11 13 Output: TIE
Example case 1. In Case 1, ABHISHEK will have students with roll number, 4,8,16,20,28 , while PARTH will have students with roll numbers, 6,18,30. So ABHISHEK wins with difference of 2 students.
Example Case 2.In Case 2, ABHISHEK will have students with roll number 11,22 , while PARTH will have students with roll numbers, 13, 26. So there is a TIE.
|Time Limit:||0.5 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, 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, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions