Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8027695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:53:14+00:00 2026-06-04T23:53:14+00:00

I have a problem to solve from SPOJ -like platform and I can’t come

  • 0

I have a problem to solve from SPOJ-like platform and I can’t come up with any idea of how to solve this. Here is the problem, translated with G translator but if something got lost i could try to translate it better

The entry gives the number of tests T (10 <= T <= 100). For each test, gives the number N (3 <= N <= 100). This number is an equilateral N angle (for example, an equilateral pentagon, for N = 5) with a side of 1. On each of the N vertices of the N-gon were seeded snails. Each snail as a “target” has set a snail to reach the other – the one who stood on the adjacent vertex (the fact that the direction of a neighboring node selection is the same all the time, ie, each snail “chasing” just one screw and each of the snail is “chased” by exactly one snail – the choice to be made by the snail only once at the beginning and does not change until the end of the chase). In one moment, snails begin to move toward its goal (at any time go exactly in a straight line to its target). It lasts until all the snails do not come in contact with each other at one point. To better illustrate this situation, please look at the picture below:

Illustrated explanation

The arrows show how the chosen target, each of the snails. The cross indicates the approximate location where all come in contact with each other. Your task is to determine the distance that come each of snails (all will make exactly the same distance). If the result is more than two decimal places is to go round the second decimal place.

In summary:

input

Number of tests T

In the next T lines of N

output

For each test, the distance that come each of the snails during the chase (the result rounded to two decimal places).

Sample input:

5

3

5

7

9

91

output:

0.67

1.45

2.66

4.27

419.69

And my wish is that someone explained me how to get the desired output from the sample input and maybe propose some algorithm that could I use.

Thanks for your time in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:53:16+00:00Added an answer on June 4, 2026 at 11:53 pm

    You need some Physics here. Look at it from the frame of reference of one of the ants. So one ant is always moving towards it. Now take the relative speed along the line joining the ants. This would come out to be v(1-cos(2*pi)/N)(Work this out. It’s easy)

    Now they meet when displacement equal to edge length. Hence time taken is 1/v(1-cos((2*pi)/n)). Distance travelled is v*t hence distance is 1/(1-cos((2*pi)/N)).

    You can check the direct formula here.

    http://mathworld.wolfram.com/MiceProblem.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem here I can't solve. I have a database of houses
i have a problem that i can't solve ! (sqlite3, but i think it
I have a problem and can't solve it alone. My teacher gives me one
I have a problem, that I can't solve. I am writing an application that
i have this problem: starting from an empty list (0 elements) i want check
I have a problem to solve which im not sure if it can be
I have the following problem to solve and I can't seem to be able
I have a problem that I'd like to solve, but I don't know how
I have problem and i don't know how to solve this simple, i have
I using multilanguage solution from this thread Multilanguage in WPF But i have problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.