T-Series Vs PewDiePie
All submissions for this problem are available.
Like everyone Chef is also interested in the rivalry between T-Series and PewDiePie about who will be the biggest youtuber (depending on no. of subscribers). Now chef has organized an event to answer this question where both the two youtubers have to face each other in a game, the winner will be the biggest youtuber of 20th century. The game is simple, there is a stack contains N numbers of disks initially. In each move, a player can remove X (>0) numbers of disks such that X divides K where K in the number of disks present at that time. The player who removes the last disk loses the game. Chef decides how many disks will be there initially and who will make the first move. Both the players are very good in this game and they play optimally.
- First line will contain $T$, number of testcases. Then the testcases follow.
- Each testcase contains of a single line of input containing $N$ and $P$, where $N$ denotes no. of disks initially present on stack and $P$ is a character “T”(For T-Series) or “P”(For PewDiePie) denoting who will make the first move.
For each testcase, output a single line as “T-Series” or “PewDiePie” (without double quotes) denoting the winner of the game.
- $1 \leq T \leq 10^5$
- $1 \leq N \leq 10^9$
|Tags||easy-medium, encoding, enma2019, game-theory, tomy_495|
|Time Limit:||1 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
If you are still having problems, see a sample solution here.