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

Solution of 10127 - Ones

Problem description:
source: https://uva.onlinejudge.org/external/101/10127.html


Given any integer 0 n 10000 not divisible by 2 or 5, some multiple of n is a number which in decimal notation is a sequence of 1’s. How many digits are in the smallest such a multiple of n?

Input

A fle of integers at one integer per line.

Output

Solution of 10189 - Minesweeper

Problem Description
source:https://uva.onlinejudge.org/external/101/10189.html

Have you ever played Minesweeper? It’s a cute little game which comes within a certain Operating System which name we can’t really remember. Well, the goal of the game is to find where are all the mines within a M × N field. To help you, the game shows a number in a square which tells you how many mines there are adjacent to that square. For instance, supose the following 4 × 4 field with 2 mines (which are represented by an ‘*’ character): 

*... 
.... 
.*.. 
.... 
If we would represent the same field placing the hint numbers described above, we would end up
with:
*100 
2210 
1*10 
1110
As you may have already noticed, each square may have at most 8 adjacent squares.


image

Solution of 10195 - The Knights Of The Round Table

Problem Description
source:https://uva.onlinejudge.org/external/101/10195.html

King Arthur is planning to build the round table in a new room, but this time he wants a room that have sunlight entering it, so he planned to build a glass roof. He also wishes his round table to shine during the day, specially at noon, so he wants it to be covered totally by the sunlight. But Lancelot wants the glass part of the room roof to be triangular (and nobody knows the reason why, maybe he made a vow or something like that). So, there will be a triangular area in the room which will be all covered by the sunlight at noon and the round table must be build in this area. 
     Now, King Arthur wants to build the biggest table that he cans such that it fits in the triangular sunlighted area. As he is not very good in geometry, he asked Galahad to help him (Lancelot is very good in geometry, but King Arthur didn’t asked Lancelot to help him because he feared that he would come up with another strange suggestion). 
    Can you help Galahad (since he’s not too good with computers) and write a program which gives the radius of the biggest round table that fits in the sunlighted area? You can assume that the round table is a perfect circle. 

image

Solution of 10110 - Light, more light

Problem Description
source:https://uva.onlinejudge.org/external/101/10110.html

There is man named ”mabu” for switching on-off light in our University. He switches on-off the lights in a corridor. Every bulb has its own toggle switch. That is, if it is pressed then the bulb turns on. Another press will turn it off. To save power consumption (or may be he is mad or something else) he does a peculiar thing. If in a corridor there is n bulbs, he walks along the corridor back and forth n times and in i-th walk he toggles only the switches whose serial is divisable by i. He does not press any switch when coming back to his initial position. A i-th walk is defined as going down the corridor (while doing the peculiar thing) and coming back again. Now you have to determine what is the final condition of the last bulb. Is it on or off?

image

Solution of 10107 - What is the Median

Problem Description
source:https://uva.onlinejudge.org/external/101/10107.html

Median plays an important role in the world of statistics. By definition, it is a value which divides an array into two equal parts. In this problem you are to determine the current median of some long integers. Suppose, we have five numbers {1,3,6,2,7}. In this case, 3 is the median as it has exactly two numbers on its each side. {1,2} and {6,7}. If there are even number of values like {1,3,6,2,7,8}, only one value cannot split this array into equal two parts, so we consider the average of the middle values {3,6}. Thus, the median will be (3+6)/2 = 4.5. In this problem, you have to print only the integer part, not the fractional. As a result, according to this problem, the median will be 4 !

Input 

The input file consists of series of integers X (0 ≤ X < 2 31) and total number of integers N is less than 10000. The numbers may have leading or trailing spaces. 

image

Solution of 10106 - Product

Problem Description
source:https://uva.onlinejudge.org/external/101/10106.html

The problem is to multiply two integers X, Y . (0 ≤ X, Y < 10250)

Input 

The input will consist of a set of pairs of lines. Each line in pair contains one multiplyer. 

Output 

For each input pair of lines the output line should consist one integer the product.

image