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

×

JMPKANG - Editorial

 0 PROBLEM LINK: Practice Author: Rupanjan Hari Tester: Rupanjan Hari DIFFICULTY : Easy PREREQUISITES : Math QUICK EXPLANATION This problem is like the problem of two cars running at two different velocities, where you have to determine when will they meet. The story has twist in this case, the starting position are different and you have to print 'YES' if they ever meet otherwise 'NO'. EXPLANATION The starting positions and velocities of the car will be giver alternately. Receive them and calculate their pace. The code snippet (written in C) below shows the checking process.  if (v1<=v2) { if (x1==x2 && v1==v2) printf("YES"); else printf("NO"); } else { //Run the loop to detect the whether the Kangaroo's will cross each other. If so set the 'flag' otherwise keep it as '0' } if (flag==1) printf("YES"); else printf("NO");  Run this code for each input x1,v1,x2,v2. SOLUTION: click here to see the solution This question is marked "community wiki". asked 14 Oct '16, 16:58 4●1 accept rate: 0% 0★admin ♦♦ 19.8k●350●498●541
 toggle preview community wiki:
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:

×15,852
×3,820
×890
×218
×1

question asked: 14 Oct '16, 16:58

question was seen: 779 times

last updated: 04 Jan '17, 13:53