Skip to content

Instantly share code, notes, and snippets.

@Harshapriya123
Last active May 24, 2019 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Harshapriya123/01d90757d52600e816e68b6d90dcb5af to your computer and use it in GitHub Desktop.
Save Harshapriya123/01d90757d52600e816e68b6d90dcb5af to your computer and use it in GitHub Desktop.
1. Problem Statement:
Tomorrowland is a futuristic cityscape somewhere in time and space. A teenage girl with scientific curiosity Casey Newton
and a former genius inventor Frank, set out for a dangerous mission to unearth the secrets of Tomorrowland.In the course of
their mission, they identified the decoded form of earth language in the sign boards and at all other places at Tomorrowland.
Frank examined the decoded text and interpreted its rules.
The decoded text contains only lower case alphabets.One alphabet in earth language is equal to the floored average of 2
alphabets in Tomorrowland.
For eg: "acde" in Tomorrowland is "bd" in earth
Write a C program to help Frank and Casey that inputs a string which refers to the decoded word in Tomorrowland
and converts it to the equivalent earth language word.
Input format:
The only line of input is a string that corresponds to the decoded word in tomorrowland.
Output format:
The output is a string that corresponds to the equivalent earth language word.
Refer to sample input and output for formatting specifications.
Sample Input 1:
acde
Sample Output 1:
bd
Sample Input 2:
acdf
Sample Output 2:
be
Problem Statement 2:
2.Frank explained to Casey that Tomorrowland has n dimensions unlike Earth which has only 3 dimensions.
Being an unexplored place, Frank also felt that there is a need for them to know the distance between any points in
the "n" dimensional space. Write a program that will input the value of "n" the number of dimensions and the
two vectors in an n-D space and would compute the distance between them.
Input Format:
The first input is an integer n, corresponds to number of dimensions.
The next n elements corresponds to the starting coordinates .
The next n elements corresponds to the ending coordinates .
Output Format:
Output consists of a float value which corresponds to the distance between the two dimensions .
Display the distance correct to 2 decimal places.
Sample Input and Output:
[All text in bold corresponds to input and the rest corresponds to output]
Enter the number of dimensions in tomorrowland
2
Enter the starting co-ordinates
10
15
Enter the ending co-ordinates
20
25
Distance between them is 14.14
Problem Statement -3
3.Athena, an AA (Audio-Animatronic) robot sneaks a "T" pin into Casey's belongings with the intention that Casey's
help would save the world.Casey sees the pin in her belongings and discovers that upon contact,the pin instantly shows
her a view of Tomorrowland. She briefly explores the vision until the pin's battery runs out. Given current battery %,
and rate of discharge of the battery(% per sec), find the no. of minutes and seconds for which she can see the Tomorrowland.
Input format:
The first input is a float value which corresponds to the battery life remaining
The second input is a float value which corresponds to the rate of battery discharge.
Output format:
Refer the sample output:
Current battery percentage
80
Rate of discharge per second
1
Time remaining 1.33 minutes
Sample Input and Output:
[All text in bold corresponds to input and the rest corresponds to output]
4. Hugo and Ursula
Casey's sees the "T" pin in her belongings and assisted by her brother Nate, finds and visits a Houston memorabilia store
related to the pin. The store's owners are two Audio-Animatronic (AA) robots, Hugo and Ursula. They question Casey
where she got the pin and approach to attack Casey and Nate despite the girl knew nothing about the pin. Casey and Nate
are in a square shaped room that has nxn unit square tiles, where n is the length of the room.
They are currently standing in one of the corners and the exit door is present diagonally opposite to the corner
where they are standing.
If they manage to escape from the room, they are safe. Since Hugo and Ursula are robots, they are programmed to
travel only in four directions (top, left, down and right) placing themselves in the center of each tile they are moving.
Given the length of the room and the speed in which the robots move, find the minimum speed in which Casey and
Nate need to run in order to escape from the robots. Casey and Nate can very well run straight on the diagonal.
Input Format:
The first line of the input is an integer that corresponds to the length of the room in metres.
The second line of the input is a float value that corresponds to the Speed of Audio-Animatronic (AA) robots
in meter per second.
Output Format:
Output is a float value that corresponds to the minimum speed of humans in meter per second .
Sample Input and Output:
[All text in bold corresponds to input and the rest corresponds to output.]
Length of the room in meters
25
Speed of Audio-Animatronic (AA) robots in meter/sec
3
Humans need to run at a minimum speed of 1.50 m/s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment