Untitled 1
Untitled 1
Untitled 1
2. Print the You are given an integer N. You need to print the series of all prime
numbers till N.
Input Format
The first and only line of the input contains a single integer N denoting the number
till where you need to find the series of prime number.
Output Format
Constraints
1<=N<=1000
SAMPLE INPUT:
SAMPLE OUTPUT
2357
BOOK CRICKET
Input format
Output format
For each test case, print the first line as "Case X:" (where X refers to the test case
number). In the next P lines, print "Player Y: " followed by the score of
the Yth player.
Note:
If the player is currently not out, output a "∗" after the score.
If the player has not yet come out to play, output "DNB" (Did not bat) instead of the
score.
It is guaranteed that at the end of the match at least 2 players are still not out.
It is guaranteed that the last ball of the match is not a "W".
Constraints
1≤T≤10
2≤P≤10
1≤N≤10000
SAMPLE INPUT
2
12
400111
24
4444W4666666
SAMPLE OUTPUT
Case 1:
Player 1: 6*
Player 2: 1*
Case 2:
Player 1: 16
Player 2: 36*
Player 3: 4*
Player 4: DNB
6(M). Akshara is a Maths teacher at Dynamic Public School.One day she decided to take an unusual
test of all her students.She took all her students to a fair.There she took them to a candy room.The
room had 2 doors and behind each door was unlimited supply of candies.The excitement of the
students could not be measured.Each student wanted a specific amount of candies.Now here was the
test.
At a time 1 student could enter 1 door.After he exits another will enter.No time is lost when there is
change of students.For proccessing 1 candy it took 1 second.The teacher gave exactly X amount of
time for all the students to get their specific amount of candies.So the students ask you for help in
determining whether it is possible for all the students to get their candies or not in X amount of time.
Input:
The first line contains T denoting the number of test cases.Each testcase consist of two lines containing
n and x denoting the number of students and the time given by the teacher.The next line contains n
space separated numbers denoting the amount of candy each student wants.
Output:
Constraints:
1<=T<=25
1<=N<=100
1<=x<=100000
0<=A[i]<=100
SAMPLE INPUT
2
3 4
2 4 2
3 3
3 3 3
SAMPLE OUTPUT
YES
NO
1(E).Patlu and Motu works in a building construction, they have to put some number of bricks Nfrom
one place to another, and started doing their work. They decided , they end up with a fun challenge who
will put the last brick.
They to follow a simple rule, In the i'th round, Patlu puts i bricks whereas Motu puts ix2 bricks.
There are only N bricks, you need to help find the challenge result to find who put the last brick.
Input:
Output:
Output "Patlu" (without the quotes) if Patlu puts the last bricks ,"Motu"(without the quotes) otherwise.
Constraints:
1 ≤ N ≤ 10000
SAMPLE INPUT
13
SAMPLE OUTPUT
Motu
Now the problem is, You are given an Array of N integers and Q queries. Each query is defined by two
integers L, R. You have to output the count of special bit numbers in the range L to R.
Input
Output
Constraints
0≤A[i]≤109
1≤N≤105
1≤Q≤105
SAMPLE INPUT
5 3
3 5 1 12 7
1 3
2 3
1 5
SAMPLE OUTPUT
1
0
3
First line consists of a single integer T denoting the number of test cases.
First line of each test case consists of two space separated integers denoting N
and X.
Second line of each test case consists of N space separated integers denoting
the array elements.
Output format:
Print the required answer for each test case on a new line.
SAMPLE INPUT
4 1
1 4 2 5
4 2
4 2 1 5
4 3
5 2 4 1
4 4
1 2 4 5
SAMPLE OUTPUT
Average
Average
Average
Good
8.Gurpreet and Shyamu were playing COD(yes you read right that is Call of Duty).
As you all know Gurpreet is too good in it. Shyamu being jealous give Gurpreet a
problem to solve so that he can clear more missions than him.
The Problem is :
k ch
In each query Gurpreet has to delete kth occurence of character ch. And at the
end he has to print the string after all queries. As Gurpreet wants to play COD
he give this task to you to solve.
Input :
The first line contains string str, and second line contains q that is number of
queries.
Output :
SAMPLE INPUT
agcdgcaag
2 a
1 c
1 d
3 g
2 a
SAMPLE OUTPUT
aggc
Convert a number in decimal form to the equivalent mixed number with the fraction portion
reduced to lowest terms.
Input: There are an unknown number of values on a single line. A –1 is used to indicate the end of
the data set.
Output: Output the integer part of the number, followed by the word AND where the decimal point
was, and then the reduced fraction. There is to be a division symbol (/) between the numerator and
the denominator of the fraction.
The output is to be formatted exactly like that for the sample output given below.
Assumptions: The numbers are in the range 1..500. There are no repeating decimals.
The –1 used to indicate the end of the data set is not part of the data for the problem.
Sample Input:
2.95 14.2 5.625 -1
Sample Output:
2 AND 19/20
14 AND 1/5
5 AND 5/8