CodeChef is a non-commercial competitive programming community
Login
Username (New User? Signup) Password (Forgot Password?)
Signup
Login or
Signup with
Connect
Note
  • Publicize your achievements on your Facebook Wall.
  • Challenge your friends or ask them for help.

Site Navigation

  • PRACTICE
    • Easy
    • Medium
    • Hard
    • Challenge
    • Peer
  • COMPETE
    • All Contests
    • June Long 2012
    • May Cook-Off
    • May Long 2012
  • DISCUSS
    • Forums
    • Blog
    • Wiki
    • Facebook
    • Twitter
  • COMMUNITY
    • CodeChef Meetups
    • Campus Chapters
    • Host your Contest
    • User Groups
    • CodeChef TechTalks
    • All Educational Initiatives
  • HELP
    • Frequently Asked Questions
    • FAQ for problem setters
    • Problem Setting
    • Tutorials
    • Long Contest Ranks
    • Short Contest Ranks
    • Event Calendar
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CodeChef Financials
    • CodeChef Sponsorships
    • CEO's Corner
    • Contact Us
    • About Directi
Home » Compete » Icoder 2010 » Fusing Particles

Fusing Particles

Problem code: ICODER2

  • All Submissions

All submissions for this problem are available.

Imagine a n-sided regular polygon. At each vertex of the polygon lies a particle 'x'. Now, in a hypothetical experiment, starting at time = 0s, each particle 'x' travels on the sides of polygon in clockwise manner with a constant speed. Therefore, a square with vertices A, B, C, D ( in clock-wise direction) , a particle 'x' starting at 'A' would move along side 'AB' and reach 'B', then travel along 'BC' and reach 'C' and so on.

Each particle has same properties except that they may or may not start with the same constant speed. Thus, a particle with a higher speed would ultimately collide into the particle in front of it when going in clockwise manner. Collision of two or more particles at a given time instant results in a fusion, thus giving rise to a single particle with same properties except that its speed is the average of the speeds of the colliding particles. The experiment stops at time = t, when a stability point is reached i.e. when there is no chance of further fusion.

Now given the total sides, length of the side of the regular polygon and speeds of different particles, you have to find 't' i.e. the time taken to reach to the stability point and the final speed of the particle(s).

Notes
- If the distance between two particles is less that 0.0000001 mts i.e. 1e-7 or 10 ^ -7, collision occurs.
- Particles follow the general kinematics rule( except for the collision rules stated above ).
- Assume there is no friction or air resistance.
- Assume that the time taken at edges and the time taken for fusion is negligible.

Constraints
- All calculations are to be done in meters and seconds.
- Use maximum precision wherever possible.

Input

1. Number of test cases = 'T' ( 1 <= T <= 500 ).
2. For each test case, first line contains number of sides in regular polygon = 'D' ( 3 <= D <= 50 ).
3. Next line contains length of a side = 'L' ( integer ) ( 5 <= L <= 10000 ) in meters.
4. Next input contains speed of all D particles ( in clockwise direction, each speed on new line ) = 'S' ( integer ) ( 5 <= S <= 1000 ) in meters per second.

Output

1. Each line of output contains total time 't' taken for the experiment to reach the stability point followed by a space and the final speed of the particle(s). Give your answer up to 6 decimal places.

Example

Input:
2

4
100
500
200
300
400

3
100
200
200
200

Output:
3.000000   350.000000
0.000000   200.000000

Author: csirubix
Date Added: 20-03-2010
Time Limit: 1 sec
Source Limit: 50000 Bytes
Languages: ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC


  • Submit

Comments

  • Login or Register to post a comment.

I was just testing the

jeetnihalani @ 21 Mar 2010 02:45 PM

I was just testing the problems, my submission won't count. You can post your queries here...

how many particles are

rebeck @ 21 Mar 2010 03:05 PM

how many particles are allowed?

u have taken 3 !!!!

rebeck @ 21 Mar 2010 03:06 PM

u have taken 3 !!!!

The contest has been extended

jeetnihalani @ 21 Mar 2010 03:07 PM

The contest has been extended up to 6 p.m.

that is clear enough, read

jeetnihalani @ 21 Mar 2010 03:08 PM

that is clear enough, read the problem carefully

at each vertex of the polygon

jeetnihalani @ 21 Mar 2010 03:10 PM

at each vertex of the polygon lies a particle, is it clear now?

thanks got it

rebeck @ 21 Mar 2010 03:11 PM

thanks got it

The contest has been extended

jeetnihalani @ 21 Mar 2010 04:32 PM

The contest has been extended up to 8 p.m.

how come the secondĀ  case is

rebeck @ 21 Mar 2010 05:26 PM

how come the secondĀ  case is possibleĀ  when they are having equal speed ,time cant be zero?

why it can't be zero, time

jeetnihalani @ 21 Mar 2010 05:28 PM

why it can't be zero, time taken to reach stability point is 0 seconds. Its clear enough...

read this "stability point is

jeetnihalani @ 21 Mar 2010 05:33 PM

read this "stability point is reached i.e. when there is no chance of further fusion" i hope its clear now.

can u give one more test

rebeck @ 21 Mar 2010 07:46 PM

can u give one more test case?

when will the results be

sanketsc @ 21 Mar 2010 08:05 PM
when will the results be declared. And please give solution for Fusing Particles

All codes are public, you may

jeetnihalani @ 21 Mar 2010 08:13 PM

All codes are public, you may view them. Also the codes would be verified and then the winners would be declared. People with the same code would be disqualified.

SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:

Programming Competition Fetching successful submissions
Directi Go for Gold
CodeChef is a global programming communityCodeChef hosts online programming competitions
CodeChef is a non-commercial competitive programming community
  • About CodeChef
  • About Directi
  • CEO's Corner
  • C-Programming
  • Programming Languages
  • Contact Us
© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs
In order to report copyright violations of any kind, send in an email to copyright@codechef.com
CodeChef a product of Directi
The time now is:
CodeChef - A Platform for Aspiring Programmers

CodeChef was created as a platform to help programmers make it big in the world of algorithms, computer programming and programming contests. At CodeChef we work hard to revive the geek in you by hosting a programming contest at the start of the month and another smaller programming challenge in the middle of the month. We also aim to have training sessions and discussions related to algorithms, binary search, technicalities like array size and the likes. Apart from providing a platform for programming competitions, CodeChef also has various algorithm tutorials and forum discussions to help those who are new to the world of computer programming.

Practice Section - A Place to hone your 'Computer Programming Skills'

Try your hand at one of our many practice problems and submit your solution in a language of your choice. Our programming contest judge accepts solutions in over 35+ programming languages. Preparing for coding contests were never this much fun! Receive points, and move up through the CodeChef ranks. Use our practice section to better prepare yourself for the multiple programming challenges that take place through-out the month on CodeChef.

Compete - Monthly Programming Contests and Cook-offs

Here is where you can show off your computer programming skills. Take part in our 10 day long monthly coding contest and the shorter format Cook-off coding contest. Put yourself up for recognition and win great prizes. Our programming contests have prizes worth up to Rs.20,000 and $700lots more CodeChef goodies up for grabs.

Discuss

Are you new to computer programming? Do you need help with algorithms? Then be a part of CodeChef's Forums and interact with all our programmers - they love helping out other programmers and sharing their ideas. Have discussions around binary search, array size, branch-and-bound, Dijkstra's algorithm, Encryption algorithm and more by visiting the CodeChef Forums and Wiki section.

CodeChef Community

As part of our Educational initiative, we give institutes the opportunity to associate with CodeChef in the form of Campus Chapters. Hosting online programming competitions is not the only feature on CodeChef. You can also host a coding contest for your institute on CodeChef, organize an algorithm event and be a guest author on our blog.

Go For Gold

The Go for Gold Initiative was launched about a year after CodeChef was incepted, to help prepare Indian students for the ACM ICPC World Finals competition. In the run up to the ACM ICPC competition, the Go for Gold initiative uses CodeChef as a platform to train students for the ACM ICPC competition via multiple warm up contests. As an added incentive the Go for Gold initiative is also offering over Rs.8 lacs to the Indian team that beats the 29th position at the ACM ICPC world finals. Find out more about the Go for Gold and the ACM ICPC competition here.

Domain Name Registration, Web hosting, and Website Design provided by BigRock.com