Sie sind auf Seite 1von 4

SCHOOL OF COMPUTING

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

WEEKLY TASK

Course Code / Course Name : 1152CS313/ COMPETITIVE CODING III

Year / Semester : 2020-21/SUMMER

Course Handling Faculty Name : Mrs.R.Elakya

Slot No : S11

Problem : 1

Write a program that asks the user to type 4 integers in an array. The program should insert 3 at
the index position 1, and then shift each element down and drop off the last element.the program
must then display the final array.

Sample input:’

Sample output:

4
Problem : 2

Lucy is a very active lady. She likes to keep all stuff sorted. She has developed an interesting
technique of sorting stuff over the years. She goes through the items repeatedly from first to last
and whenever she finds two consecutive items unsorted, she puts them in the proper order.
She continues the process until all the items are sorted. One day Mommy has to attend a wedding
ceremony. Suddenly she remembers that she has not sorted the plates after washing.
She has only M minutes left. If she can complete the task within the remaining time, she will sort
her plates and then attend the wedding. However if she cannot, she decides to skip the task.
She knows that she take S seconds per swap. However she does not know the total number of
swaps required and hence she is in trouble. She wants you to help her out.
Input:
The first line of input takes the number of test cases T .Then T test cases follow .
Each test case contains 2 lines . The first line of each test case contains 3 space separated
integers M,S and N, where N is the number of plates .
The next line of the test case contains N space separated values which denotes the size of the
plates .
Output:
Print 1 if mommy can complete the task, 0 otherwise.
Constraints:
1<=T<=100
1<=M<=100
1<=S<=100
1<=N<=100
1<=Size of Plate<=200

Input:
3
20 15 5
35 10 85 90 30
10 30 10
48 14 37 29 30 47 11 23 25 8
5 40 8
25 28 12 20 6 5 37 26
 
Output:
1
0
0
Problem : 3

Joey loves to eat Pizza. But he is worried as the quality of pizza made by most of the restaurants
is deteriorating. The last few pizzas ordered by him did not taste good :(. Joey is feeling
extremely hungry and wants to eat pizza. But he is confused about the restaurant from where he
should order. As always he asks Chandler for help.

Chandler suggests that Joey should give each restaurant some points, and then choose the
restaurant having maximum points. If more than one restaurant has same points, Joey can
choose the one with lexicographically smallest name.

Joey has assigned points to all the restaurants, but can't figure out which restaurant satisfies
Chandler's criteria. Can you help him out?

Input:

First line has N, the total number of restaurants.

Next N lines contain Name of Restaurant and Points awarded by Joey, separated by a space.
Restaurant name has no spaces, all lowercase letters and will not be more than 20 characters.

Output:

Print the name of the restaurant that Joey should choose.

Constraints:

1 <= N <= 105

1 <= Points <= 106

SAMPLE INPUT 1
 
3
Pizzeria 108
Dominos 145
Pizzapizza 49

SAMPLE OUTPUT 1
 
Dominos

SAMPLE INPUT 2
 
2
Pizzeria 108
Pizzapizza 108

SAMPLE OUTPUT 2

Pizzapizza

Das könnte Ihnen auch gefallen