Posts

Showing posts from April, 2022

Lucy at the Film Festival

  Lucy at the Film Festival   LucarnosFilm Festival is an annual film festival and is also known for being a prestigious platform for art house films. This time at the Lucarnos Film festival there are  N  movies screened, each of different genre ranging from drama movies to comedy ones and teen movies to horror ones. Lucy is a huge fan of movies and visited the film festival, but she's not sure which movie she should watch. Each movie can be characterized by two integers  L i  and  R i , denoting the length and the rating of the corresponding movie. Lucy wants to watch exactly one movie with the maximal value of  L i  × R i . If there are several such movies, she would pick a one with the maximal  R i  among them. If there is still a tie, she would pick the one with the minimal index among them.   Write a program to help Lucy pick a movie to watch at the film festival.   Input Format: The first line of the input descriptio...
  Favorite Sequence   Lucarnos Film Festival is an annual film festival and is also known for being a prestigious platform for art house films. Lucy, being a movie lover visits the Lucarnos Film Festival. There were many films screened in the show, of which Lucy somehow choose the best movie of her choice and set off to watch it. The movie which Lucy chose to watch has  N  sequences. A sequence is defined as a series of scenes in a movie that form a distinct narrative unit. Lucy likes a sequence better if the sequence contains her favorite sequence in the movie as a substring.   Given the sequence and Lucy’c favorite sequence(F) check whether her favorite sequence is contained in the sequence.   Input Format: The first line of the input contains an integer N, which corresponds to the length of the sequence. The second line of the input contains N space-separated integers, which corresponds to the sequence. The third line of the input contains an integer n, ...
  Adjacent Stick Game   Steffan and friends have set out on a vacation to Coorg. They have booked accommodation in a resort and the resort authorities organize Camp fires every night as a part of their daily activities. Steffan volunteered himself for an activity called the "Adjacent Stick Game" where sticks of different length will be placed in a line and Steffan needs to remove a stick from each adjacent pair of sticks. He then has to form a bigger stick by combining all the remaining sticks.   Steffan needs to know the smallest length of the bigger stick so formed and needs your help to compute the same. Given the number of sticks N and the lengths of each of the sticks, write a program to find the smallest length of the bigger stick that is formed.   Input Format: First line of the input contains an integer N denoting the number of sticks. Assume that the maximum value for N as 50. Assume that  N is always   even . Next line of input contains an N integ...
  Bob's Challenge   Stella and friends have set out on a vacation to Manali. They have booked accommodation in a resort and the resort authorities headed by Bob, organize Campfires every night as a part of their daily activities. Stella volunteered herself for an activity called the "Stick Game". Stella was given a total of  N  sticks. The length of  i -th stick is  A i . Bob insists Stella choose any four sticks and make a rectangle with those sticks as its sides. Bob warns Stella not to break any of the sticks, she has to use sticks as a whole.   Also, Bob wants that the rectangle formed should have the maximum possible area among all the rectangles that Stella can make. Stella takes this challenge up and overcomes it. You have to help her know whether it is even possible to create a rectangle. If yes, then tell the maximum possible area of the rectangle.   Input Format: The first line of the input contains a single integer  N  denotin...
  Hazecraft Client Series    The Event Organizing Company "Hazecraft" focuses on event management in a way that creates a win-win situation for all involved stakeholders. Hazecraft doesn't look at building one time associations with clients but aim at creating long-lasting collaborations that will span years to come. This goal of the company has helped them to evolve and gain more clients within a notable time. The number of clients of the company from the start day of their journey till now is recorded sensibly and is seemed to have followed a specific series like 2,3,5,7,11,13,17,19, 23,…, etc   Write a program that takes an integer N as the input and will output the series till the Nth term.   Note: The given series is prime number series.   Input Format: The first line of the input is an integer N. Output Format: The output is a single line series till Nth term, each separated by a space. Refer sample input and output for formatting specifications. Samp...
  Seven Segment Display   The Event Organizing Company "Buzzcraft" wanted to procure seven segment displays to display any numeric information display boards, scrolling ad banners, etc., to place it in their Events. The Company contracted out their order to MDC team at Orange labs who designs embedded sensing nodes and provides connectivity to tie them to the internet of things. They are working on building seven segment displays. But the Company wanted to know how many seven segment displays will they need to represent an Integer  x . They use one seven segment display to represent one digit of an Integer. For example: Integer "100" needs "3" seven segment boards to be represented. Help them find out how many displays are needed?   Input Format: First and only line consists of one positive integer that needs to be represented using seven segment displays. Output Format: Output a single line containing the number of digits of that integer. Refer sample inp...