Thread: Somebody Help Me !

  1. #1
    Registered User
    Join Date
    Mar 2019

    Somebody Help Me !

    In his twenties, Manager was a passionate racing driver. He got his first 105LS (Speed ​​Laser) to his 18th birthday. For a while, thanks to her, she even seemed to be a career manager of a successful manager - and that will be the career of a successful driver. Although it was a standard old, rusty skidder, which itself took off excess parts, had a Manager-and respect because she was a peer. And of course - it was her - Barbara.

    Loss of excess parts even happened on the dashboard when the wrecker dropped from the speedometer. Although the Manager, as the correct representative of the DIY movement, managed to stuck it back, it soon found out that he had stuck it at the wrong angle. So even if the tachometer showed the value of the current velocity v, its actual value was in + k, where k is an unknown constant (probably negative).

    So the manager began to make honest notes of the rides he had gone through to find out the value of the mysterious constant to. Records from each drive consist of n parts. Each part of the drive contains the distance traveled s and the speed value v, which was then indicated by the speedometer. The whole record took time t. Help the Manager create a program to get the secret value of k from the measured data.


    The first line of input contains two integers: n (1 ≤ n ≤ 1000), which represents the number of parts of a single drive, and t (1 ≤ t ≤ 10 ^ 6), which represents the total driving time. This is followed by n lines, each of which describes one part of the drive that the Manager has recorded. Each row contains two integers: s (1 ≤ s ≤ 1000) and v (| v | ≤ 1000), the distance and speed indicated by the tachometer with the hand stuck during that part of the trip. The time is given in hours, the distance in kilometers and the speed in kilometers per hour.

    Mysterious constant k given in kilometers per hour. However, the deviation in your response must be less than 6 decimal places.

  2. #2
    Registered User
    Join Date
    May 2009
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Oh great, the clueless codechef wannabies are over here now.

    How To Ask Questions The Smart Way
    Pick a decent title.
    Make some kind of effort to actually solve your problem.
    As a specific question about what is confusing you.

    Thread closed.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Tags for this Thread