We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. C
  3. Structs and Enums
  4. Small Triangles, Large Triangles

Small Triangles, Large Triangles

Problem
Submissions
Leaderboard
Discussions
Editorial

You are given triangles, specifically, their sides , and . Print them in the same style but sorted by their areas from the smallest one to the largest one. It is guaranteed that all the areas are different.

The best way to calculate a area of a triangle with sides , and is Heron's formula:

where .

Input Format

The first line of each test file contains a single integer . lines follow with three space-separated integers, , and .

Constraints

  • , and

Output Format

Print exactly lines. On each line print space-separated integers, the , and of the corresponding triangle.

Sample Input 0

3
7 24 25
5 12 13
3 4 5

Sample Output 0

3 4 5
5 12 13
7 24 25

Explanation 0

The square of the first triangle is . The square of the second triangle is . The square of the third triangle is . So the sorted order is the reverse one.

Author

bayleef

Difficulty

Medium

Max Score

30

Submitted By

84601

Need Help?


View discussions
View editorial
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy