# UVa 11455

Jump to navigation
Jump to search

## Contents

## 11455 - Behold my quadrangle[edit]

## Summary[edit]

Given 4 lengths, you are to determine if these can form a square, rectangle, quadrangle or none of these.

## Explanation[edit]

Easiest way is to sort the array of lengths then check the following:

- Square: all 4 sides are equal.
- Rectangle: each 2 sides are equal.
- Quadrangle: maximum of these lengths must be less than the sum of other 3.
- Banana: if none of the above conditions is satisfied, then print "banana".

## Gotchas[edit]

- Although the problem statement states all lengths are positive, there are zeros in the input and you will get WA unless you handle these.
- According to the judge, it is legal to have side of length 0.

## Implementations[edit]

Notes/Hints on actual implementation here.

## Optimizations[edit]

Optimizations here.

## Input[edit]

10 10 8 7 6 9 1 9 1 29 29 29 29 5 12 30 7 0 0 0 0 0 1 0 1 0 0 1 1 1 2 3 6 1 2 3 4 8 8 8 0

## Output[edit]

quadrangle rectangle square banana square rectangle rectangle banana quadrangle quadrangle

## Categories[edit]

Computational Geometry