You are on page 1of 5

PROBLEM 1 : PADOVCNT

Anvi & Abhi went to Byteland last year. This country has a large number of beautiful and tall trees planted in multiple rows.The front tree in each row is marked with a number. What's special about these plantations is that if the visiting person gets to know that number,he she can easily count the number of trees in that row. The numbers trees in a particular row is s!uare of i, where i denotes the marked number on the front tree of that particular row. "e observes that,for the first few rows, the front trees are marked as follows# $, $, $, %, %, &, ', (, ), *, $%.....and so on. +ow, Anvi's friend Abhi is both la,y and genius. "e has been assigned task to count the total number of trees till the nth row.Being a genius he determines the pattern !uickly,but due to la,iness,he doesn't do the counting part.-ou,as his assistant,have to do this task for him. INPUT# The first line of input begins with an integer T, where T denotes the number of test cases. The ne.t line contains an integer +, where + denotes the number of rows. OUTPUT# /or each test case, print the total number of trees till +th row. CONSTRAINTS# 01T12$0 012+12(0 Sample INPUT # & % & ) Sample OUTPUT # % & &3

PROBLEM 2 :CANIBHL
Anvi & Abhi,both best friends, are great magicians too. They were going to picnic. 4n the way, they stop by a house.Anvi uses her magic powers to determine that there are + windows of this house,all of which are operated by a set of buttons. Abhi then uses his 5B4467B446 magic5 and they both magically get access to the room where these buttons are present. /ollowing conversation takes place between them # Anvi # 5 "ey 8 9ets play a game 88 5 Abhi # 5 :ool 88 5 Anvi # 5 9ets press buttons in a particular order.5 Abhi # 5 As you say 6am 88 Tell me the order of pushing the buttons too 88 5 Anvi # 5 ; am going to press all the buttons that are multiples of $5 Abhi # 5 After that, ; will press all buttons that are multiples of %5 Anvi # 5 Then, ; will press all the buttons that are multiples of &5 Abhi # 5 ; got your point. We continue playing in manner this until + 5 Anvi # 5 -ep8 -ou got it right. After we are done, 9ets move out and continue to our destination 5 Abhi # 5 As you say 6am 88 5 <ach press of button toggles the state of the window, i.e. a window that is open will be closed by the button press and opened if closed initially. All windows were initially closed, find the number of windows that are open after they left. INPUT The input contains several lines. /irst line contains the number T, which denotes the number of test cases that follow. This is followed by T lines of numbers which represent +. 0 1 T 1 %( 0 1 + 1 $0=$) OUTPUT /or each input, output the number of windows that are open at the end. SAMPLE INPUT # % $)3 *) SAMPLE OUTPUT # $& *

PROBLEM 3: CATLME
Anvi loves >airymilk ?ilk chocolates 88 #@ ?he has n chocolates which are represented on paper as follows # p$ p% p& p'.... pn ?he wanted to embrace her chocolates by putting brackets on paper so as to protect them. /or e.ample if n2', the different ways are AAAp$ p%B p&B p'B AAp$ p%B Ap& p'BB Ap$ AAp% p&B p'BB Ap$ Ap% Ap& p'BBB AAp$.Ap%.p&BB.p'B Thus, we see that the number of ways of putting brackets around the chocolates is (. ?he has been assigned the task to find the number of ways to put brackets in such e.pression of length n. -ou have to help her. INPUT: The first line contains the number of test cases t 12$0. <ach of the ne.t t lines contain single integers 12$000 denoting n. OUTPUT: >isplay t lines containg the number of ways to put brackets in the e.pression of length n modulo $0000. Sample Input# & ' ( (00 Sample Output: ( $' $C'0

PROBLEM 4: TRIBOMOD
Anvi is a 6ath 9over.?he likes to browse wiki for special series of numbers.?he isAand ; hope everyone isB famaliar with /ibonacci number series.;n mathematical terms, the se!uence /AnB of /ibonacci numbers is defined by the recurrence relation # /AnB 2 /An7$B D /An7%B with base values # /A0B2/A$B2$ With the help of above relation one can find the nth /ibonacci number easily.?he was browsing wiki page for /ibonacci +umber and ; found another se!uence,known as Tribonacci +umbers,is defined mathematically as# TAnB 2 TAn7$B D TAn7%B D TAn7&B with base values# TA$B2$, TA%B2$, TA&B2%. Esing this recurrence relation, ?he was able to determine the first few Tribonacci numbers. But for large values, she is making mistakes every time. ?o,; want you to help her in determining the nth Tribonacci number. INPUT# The first line of input begins with an integer T, where T denotes the number of test cases. The ne.t line contains an integer +, where + denotes an integer. OUTPUT# /or each test case, print the nth Tribonacci number. ?ince the answer could be large, output the answer modulo $00000000). CONSTRAINTS: 01T12$00 $12+12$000000000 Sample INPUT : & % $0 $00000000 Sample OUTPUT : $ $'* 3()0(C'*

PROBLEM

: !NO"BIT

Abhi love to play with data structures. While browsing into the world of pu,,les he found the following problem written # 5-ou have n candies with you. ;ntially, the values of all the n candies are ,ero. +ow, you are given F !ueries to be performed . They are 7 GAssume n candies are arranged as arrays.H $B 0 . y , 7 Add , to all values in the range of . to y AinclusiveB, where . and y are two inde.es of the array. %B $ . y 7 print a single integer which is the sum of all the values of all candies between . and y AinclusiveB INPUT ;n the first line you'll be given T, number of test cases. <ach test case will start with + and F . +e.t line contains F !ueries in the format as mentioned above. OUTPUT @rint the answers of the !ueries. CONSTRAINTS: +12$00 000 F12$00 000 $12.,y12+ and $12,12$0=). Sample Input: $ C3 0 % ' %3 0 ' ) C0 0 ' ( %( $CC 0 ( 3 $' $') Sample Output: 0 '%'

You might also like