Showing posts with label Uva - Ad Hoc. Show all posts
Showing posts with label Uva - Ad Hoc. Show all posts

Uva 105 - The Skyline Problem

Sep 26, 2015

problem: The Skyline Problem (download)
Description:[Ad hoc, Brute force] 
1.    First store height in H[10000] array according to the low:
2.    Always lower limit =1 & let upper limit=0;
3.    Each time we take input(Left,Height,Right co-ordinate)
4.    From left to right , if H[i]>height, then H[i]=height
5.    End of taking Input, print the H[N], According to the description of output

Uva 100. 3n+1 problem

Nov 21, 2009

Problem Link: Download


Backgroud of the Solution:

1. the value of j can be less than the value of i; i.e j<i
2. i=j
3. The order of i and j in output must be the same as the input, even when j is smaller than i.
Note: To get the problem in good time you must create an array with size 1000000. Then you can apply recursive algorithm.

Uva 10055 - Hashmat the Brave Warrior

Problem: Download

Tips:
1. Use unsigned int

Uva 10137 the trip

Nov 17, 2009

Problem: 10137.the trip

Tips:
1.
If (currentStudentPayment > averagePayment)
positiveDifference += currentStudentPayment - averagePayment;
Else
negativeDifference += averagePayment - currentStudentPayment;

if(negativeDifference > positiveDifference)
return negativeDifference
else
return positiveDifference

2. Here negative or positive difference must be int which is the tic of this problem More

Uva 10116 robot motion

Problem: 10116.robot motion
Tips:
1. First you have to input correctly.
2. Take two array on is indicate input array other array element represent movement number.
3. If out of col or row then only print count step
4. Otherwise count -arry count current position value -1
5. And count= count-loop count;
6. End

Uva 10041 Vito's Family

Problem: 10041 -Vito's Family

Background
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.

Uva 102 Ecological Bin Packing

Problem: 102 Ecological Bin Packing

Background

Bin packing, or the placement of objects of certain weights into different bins subject to certain constraints, is an historically interesting problem. Some bin packing problems are NP-complete but are amenable to dynamic programming solutions or to approximately optimal heuristic solutions.
In this problem you will be solving a bin packing problem that deals with recycling glass.

Uva 492 Pig-Latin

Oct 28, 2009

Problem: 492 Pig-Latin

You have decided that PGP encryptation is not strong enough for your email. You have decided to supplement it by first converting your clear text letter into Pig Latin before encrypting it with PGP.

Uva 729 The Hamming Distance Problem

Problem: 729.The Hamming Distance Problem

The Hamming distance between two strings of bits (binary integers) is the number of corresponding bit positions that differ. This can be found by using XOR on corresponding bits or equivalently, by adding corresponding bits (base 2) without a carry. For example, in the two bit strings that follow:
A 0 1 0 0 1 0 1 0 0 0
 B 1 1 0 1 0 1 0 1 0 0 
A XOR B = 1 0 0 1 1 1 1 1 0 0
The Hamming distance (H) between these 10-bit strings is 6, the number of 1's in the XOR string.