All submissions for this problem are available.Sagar has a bad habbit of playing with switches on switchboard. He likes to turn them on and off. One day he was irritating Akash with sound of the switch. To stop Sagar, Akash decided to give him a task, so that Sagar keeps busy with the task and does not bother him.
The room in which Akash and Sagar are sitting has a fan. This fan has 2 switches to opearate.
Akash gives the initial state of fan (F) and both the switches (S1,S2).
He then gives Sagar Q queries. Each of these query has current state of switches. Akash then asks Sagar to tell the state of the fan for each of these query.
Sagar is unable to complete the task, so he asks for your help.
Note : Off State is denoted by 0 and On state is denoted by 1.
- First line of input contains T denoting number of test cases.
- First line of each test cases has F, S1, S2
- Second line contains Q
- Next Q lines denote current state of switches S1, S2
For each testcase, output in a single line denoting current state of fan.(ON or OFF)
- 1 <= T <= 1000
- 1 <= Q <= 100
1 1 1
|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