You are not logged in. Please login at www.codechef.com to post your questions!

×

# AVHNLIN - Editorial

Author: Amit Kumar Pandey
Editorialist: Arkapravo Ghosh

SIMPLE

Math

# PROBLEM:

We are given two lines a1x + b1x + c1 and a2x + b2y + c2, we need to find the intersection points of the lines.

# EXPLANATION:

Now, given two lines a1x + b1x + c1 and a2x + b2y + c2, we can find the intersection of the lines by the formula:-
x' = (b1c2 - b2c1)/(a1b2 - a2b1)
y' = (c1a2 - a1c2)/(a1b2 - a2b1)

You just need to take care of the point that in Java infinity is printed as 'Infinity' and in other languages it's printed different, e.g. 'inf' in C++. You need to print 'Infinity' to get AC.

You can find the author's solution and my solution below. Hope this helps.:)

# AUTHOR'S AND EDITORIALIST'S SOLUTIONS:

Author's solution can be found here.
Editorialist's solution can be found here.

# RELATED PROBLEMS:

asked 10 Jun '18, 12:30

3436
accept rate: 21%

 toggle preview community wiki:
Preview

### Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×1,186
×81
×23
×7
×3

question asked: 10 Jun '18, 12:30

question was seen: 74 times

last updated: 10 Jun '18, 12:30