Showing posts with label Volume C. Show all posts
Showing posts with label Volume C. Show all posts

Solution of 10008 - What's Cryptanalysis?

Problem Description
source:http://uva.onlinejudge.org/external/100/10008.html

Cryptanalysis is the process of breaking someone else’s cryptographic writing. This sometimes involves some kind of statistical analysis of a passage of (encrypted) text. Your task is to write a program which performs a simple analysis of a given text. 

Input 

The first line of input contains a single positive decimal integer n. This is the number of lines which follow in the input. The next n lines will contain zero or more characters (possibly including whitespace). This is the text which must be analyzed.

image

Solution of 10071 - Back to High School Physics

Problem Description
source:https://uva.onlinejudge.org/external/100/10071.html

A particle has initial velocity and acceleration. If its velocity after certain time is v then what will its displacement be in twice of that time? 

Input 

The input will contain two integers in each line. Each line makes one set of input. These two integers denote the value of v (−100 ≤ v ≤ 100) and t (0 ≤ t ≤ 200) (t means at the time the particle gains that velocity) 

image

Solution of 10070 - Leap Year or Not Leap Year and

Problem Description
source:https://uva.onlinejudge.org/external/100/10070.html

The ancient race of Gulamatu is very advanced in their year calculation scheme. They understand what leap year is (A year that is divisible by 4 and not divisible by 100 with the exception that years that are divisible by 400 are also leap year.) and they have also similar festival years. One is the Huluculu festival (happens on years divisible by 15) and the Bulukulu festival (Happens on years divisible by 55 provided that is also a leap year). Given an year you will have to state what properties these years have. If the year is not leap year nor festival year, then print the line ‘This is an ordinary year.’ The order of printing (if present) the properties is: leap year → huluculu → bulukulu. 

image

Solution of 10055 - Hashmat the brave warrior

Problem Description
source:https://uva.onlinejudge.org/external/100/10055.html

Hashmat is a brave warrior who with his group of young soldiers moves from one place to another to fight against his opponents. Before Fighting he just calculates one thing, the difference between his soldier number and the opponent’s soldier number. From this difference he decides whether to fight or not. Hashmat’s soldier number is never greater than his opponent.

Input 

The input contains two numbers in every line. These two numbers in each line denotes the number soldiers in Hashmat’s army and his opponent’s army or vice versa. The input numbers are not greater than 232. Input is terminated by ‘End of File’. 

image

Solution of 10041 - Vito's Family

Problem Description
source:https://uva.onlinejudge.org/external/100/10041.html

The world-known gangster Vito Deadstone is moving to New York. He has a very big family there, all of them living in Lamafia Avenue. Since he will visit all his relatives very often, he is trying to find a house close to them. 
    Vito wants to minimize the total distance to all of them and has blackmailed you to write a program that solves his problem. 

Input 

The input consists of several test cases. The first line contains the number of test cases. 
      For each test case you will be given the integer number of relatives r (0 < r < 500) and the street numbers (also integers) s1, s2, . . . , si , . . . , sr where they live (0 < si < 30000 ). Note that several relatives could live in the same street number. 

image

Solution of 10035 - Primary Arithmetic

Problem Description
source:https://uva.onlinejudge.org/external/100/10035.html

Children are taught to add multi-digit numbers from right-to-left one digit at a time. Many find the “carry” operation - in which a 1 is carried from one digit position to be added to the next - to be a significant challenge. Your job is to count the number of carry operations for each of a set of addition problems so that educators may assess their difficulty.

Input 

Each line of input contains two unsigned integers less than 10 digits. The last line of input contains ‘0 0’. 

image

Solution of 10038 - Jolly Jumpers

Problem Description
source:https://uva.onlinejudge.org/external/100/10038.html

A sequence of n > 0 integers is called a jolly jumper if the absolute values of the difference between successive elements take on all the values 1 through n − 1. For instance, 
                1 4 2 3 
is a jolly jumper, because the absolutes differences are 3, 2, and 1 respectively. The definition implies that any sequence of a single integer is a jolly jumper. You are to write a program to determine whether or not each of a number of sequences is a jolly jumper. 

image

Solution of 10018 - Reverse and Add

Problem Description
source:https://uva.onlinejudge.org/external/100/10018.html

The “reverse and add” method is simple: choose a number, reverse its digits and add it to the original. If the sum is not a palindrome (which means, it is not the same number from left to right and right to left), repeat this procedure.

For example: 
                       195 Initial number 
                       591 
                       —– 
                       786 
                       687 
                      —– 
                     1473 
                     3741 
                     —– 
                    5214 
                    4125 
                    —– 
                    9339   Resulting palindrome

image