Task 1: Puzzle
Putte has designed a robot that puts puzzles. First, the robot puts all the edge pieces first, and then all the inner pieces. Putte has calculated that the time it takes for the robot to solve a puzzle is
where k is the number of edge bits and n is the number of inner pieces. Your task now is to write a program that given the size of a puzzle calculates how long it will take the robot to put the puzzle.
The input data consists of two integers x and y indicating the number of puzzle pieces in each x and y led. You can assume that 1<=x<=100 and 1<=y<=100
The output should consist of 5 integers, printed on a line with a space between each number. The 5 numbers should indicate how many years, days, hours, minutes, and seconds it takes for the robot to solve the puzzle. We count 365 days a year, and for simplicity, we only count the full seconds (so if, for example, it takes 1 minute and 42,453 seconds for the robot to put the puzzle, then the output should be
0 0 0 1 42
Sample Input and output
Sample no. sample input sample output
1. 3 12 0 0 0 0 36
2. 6 6 0 0 0 0 37
3. 30 30 0 2 20 33 4
Task 2: Appointment
This task consists of writing a scheduling system type Doodle (http://www.doodle.com)
that has given a number of possible meeting times and the meeting participants' preferences produce the best suggestions on meeting times.
Input starts with two integers m and d, where m is the number of meeting times and d is the number of participants at the meeting. Then follow m rows of meeting times. Each such line starts with a serial number (0,1,2 .. etc.) and ends with a description (eg Monday 4 April 13-15). Thereafter follows d rows describing meeting participants' preferences. Each such row begins with a name and then follows the numbers of the meeting times people have specied as possible.
The output should consist of a list of all meeting times, sorted by order of how popular the meeting times were. If several meeting times are equally popular, they should be printed in numerical order. Each line must include both the description of the meeting time and the number of votes.
0 Monday 4 april 13-15
1 Tuesday 5 april 10-12
2 Wednesday 6 april 13-15
3 Thursday 7 april 8-10
4 Friday 8 april 10-12
kalle 0 1 2
nisse 2 3
sara 3 0
ali 0 4
0 Monday 4 april 13-15 3
2 Wednesday 6 april 13-15 2
3 Thursday 7 april 8-10 2
1 Tuesday 5 april 10-12 1
4 Friday 8 april 10-12 1
Hint: To solve the task, define a help class MeetingTime that represents a possible time for the meeting. This class should implement the interface Comparable < MeetingTime > with the method compareTo to easily compare which of two times is the most popular. You can read more about Comparable here and here, and more about the interface in general here The possible times should then be represented as an array of MeetingTime. Class arrays provide a convenient way to sort arrays using the method sort.
Task 3: Comments
The author Filip usually writes comments on himself when he writes books. In order to distinguish the comments from the ordinary text, he begins and ends the comments with special characters. At the beginning of his career, he started and ended comments with "%". Then his text looked like this: "Charles knocked on the door and a woman opened it. % Don't forget that Charles has already met this woman in chapter 5! % She looked at him. -
Yes?, she said."
Later Filip realized that it would probably be good to start comments with / * instead and end them with * /. Then the text would look like this: "Charles knocked on the door and a woman opened it. /* Don't forget that Charles has already met this woman in chapter 5! */ She looked at him. -
Yes?, she said."
Now Filip uses both systems alternately so that the same text can contain both comments between two % characters, and comments between / * and * /. This drives his publisher to madness. Your task now is to write a program that removes all comments from Philip's manuscript and only retains the book text. Input consists of a text with comments. You can assume that the text is between 2 and 10000 characters long, and contains only the characters az, AZ, 0-9, and some common punctuation (.,!?% / * '-).
The output should consist of the altered text without comments. If a comment is opened, either with "%" or "/*", but never closed, the comment is assumed to continue until the end of the text.
Task 4: Roch symmetric images
Roch images (or ink-plump images) have been used in psychology for various purposes. These images are created by folding a paper over an ink drop, and the images are therefore symmetrical through a vertical centerline. This task involves writing a program that determines whether an image is symmetrical through a vertical centerline or not.
Input starts with two integers between 2 and 10000, which indicate how many rows and columns the image consists of. Then follows the image, where "X" indicates a lled pixel, and "." indicates void.
Output should be "Yes" if the image is a correct Rorschach image, and "No"
Task 5: Enigma
Enigma was the name of an encryption machine used by the German armed forces during the Second World War. The Enigma machine-translated messages in clear text into encrypted messages letter by letter, in such a way that different occurrences of a clear text letter (eg "t") could be translated into different letters in the crypto text. For example, "Wetter" could be translated to "fdzxrh". The crypt was broken by the Allies, much because of a cryptographic weakness in Enigma's construction.
The weakness of the Enigma crypt was that a given letter in the clear text could never be translated into itself. This was utilized by the code breakers as follows: Assuming that a certain word (eg, "Wetterbericht") was included in the clear text, and the crypto text looked like this: "astfxahbkljytrbtjkhlhuihlkj", one could draw certain conclusions:
Input starts with a crypto text that is between 20 and 10000 characters long and then follows a word that is between 1 and 50 characters long. You can assume that both plain text and crypto text contains only the lowercase ("lowercase") letters az.
The output should consist of all positions in the crypto text where the clear text word could begin, separated by spaces. If there are no such positions, "-1" should be printed.
Feel free to contact us and take the advantages of Java assignment help services offered by us. We are the best assignment writing service provider and to solve all your academic worries. You can easily connect with us through phone, e-mail, or live chat. You can contact us anytime; our experts are always available for your help. Besides this, We will also provide CONSULTANCY for your app for FREE!
so, if you are still reading this and have an app idea, drop us a message, we can surely talk and discuss your project and get things done!. You are just one step away to get it done.