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

×

AVHNLIN - Editorial

2
1

PROBLEM LINK:

Practice
Contest

Author: Amit Kumar Pandey
Editorialist: Arkapravo Ghosh

DIFFICULTY:

SIMPLE

PREREQUISITES:

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:

*AVNRTRI

asked 10 Jun '18, 12:30

horsbug98's gravatar image

4★horsbug98
3436
accept rate: 21%

toggle preview
Preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • 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