10466 - How Far?
Moderator: Board moderators
Can someone tell me why the output for
is
and not
???
what I am thinking is that as a planet revolve against its parent planet all of its child planet also get moved along (as suppose to staying at the right (initial position)).
So, If I have a case
3 2
1 4
1 1
1 1
I should get 1,2,3 and not 1, 0, 1
Is that incorrect logic?
Code: Select all
3 2
20 4
30 4
40 4
Code: Select all
20.0000 50.0000 90.0000
Code: Select all
20.0000 10.0000 30.0000
what I am thinking is that as a planet revolve against its parent planet all of its child planet also get moved along (as suppose to staying at the right (initial position)).
So, If I have a case
3 2
1 4
1 1
1 1
I should get 1,2,3 and not 1, 0, 1
Is that incorrect logic?
-
- Guru
- Posts: 1080
- Joined: Thu Dec 19, 2002 7:37 pm
Yes, the description is a bit imprecise in it's definition of 'rotation period'. But you should consider the the rotation period of planet i as seen from planet i-1 relative to the stars. So if the periods of planet i and planet planet i+1 are the same, then planets i-1, i and i+1 are always on one line (the sun is planet 0).
Also the sample data is a bit unrealistic, because the radii increase going outward from the sun. Such a planetary system could never exist in reality. But that doesn't make the problem unsolvable, as long as you ignore planetary collisions.
Also the sample data is a bit unrealistic, because the radii increase going outward from the sun. Such a planetary system could never exist in reality. But that doesn't make the problem unsolvable, as long as you ignore planetary collisions.
The biggest problem with most problems is not how to solve the problem, but how to not solve what is not the problem.
-
- Experienced poster
- Posts: 109
- Joined: Sat Jun 23, 2007 9:53 pm
- Location: Brest, BELARUS
- Contact:
Hi people!
I have already received too many AC PE verdicts by judge. And I want to know where my presentation can be wrong...
1) I output exactly one space between the output numbers for each planet.
2) I output NO spaces after the last planet.
3) I output NO blank like after the last test case
4) Here is my code (I will delete it as soon as possible, as it's almost AC, you know):
Thanx in advance! ![:)](./images/smilies/icon_smile.gif)
PS little joey, 1111 posts, nice![:)](./images/smilies/icon_smile.gif)
I have already received too many AC PE verdicts by judge. And I want to know where my presentation can be wrong...
1) I output exactly one space between the output numbers for each planet.
2) I output NO spaces after the last planet.
3) I output NO blank like after the last test case
4) Here is my code (I will delete it as soon as possible, as it's almost AC, you know):
Code: Select all
program Project2;
{$APPTYPE CONSOLE}
var
x,x0,y,y0,alpha: extended;
i,ci,n: integer;
gt: extended;
r,t: array [1..100] of extended;
begin
ci := 0;
while not eof do
begin
readln (n,gt);
if eof then break;
for i:=1 to n do
readln (r[i],t[i]);
ci := ci + 1;
if ci>1 then
writeln;
write (r[1]:0:4);
alpha := (gt/t[1])*(2*pi);
x0 := r[1]*cos(alpha);
y0 := r[1]*sin(alpha);
for i:=2 to n do
begin
write (' ');
alpha := (gt/t[i])*(2*pi);
x := r[i]*cos(alpha) + x0;
y := r[i]*sin(alpha) + y0;
write (sqrt(x*x+y*y):0:4);
x0 := x;
y0 := y;
end;
end
end.
![:)](./images/smilies/icon_smile.gif)
PS little joey, 1111 posts, nice
![:)](./images/smilies/icon_smile.gif)
Now I lay me down to sleep...
my profile
my profile
-
- Experienced poster
- Posts: 109
- Joined: Sat Jun 23, 2007 9:53 pm
- Location: Brest, BELARUS
- Contact:
yiuyuho, man, it is unbelievable!!
I had my program written _as you said_ some time before, and it got AC PE. I posted here modified version, which didn't put "\n" after the last case (made specially), but it got AC PE. Now, I turned back to _as you said_ version, and it got ACCEPTED!!
Thank you!
I had my program written _as you said_ some time before, and it got AC PE. I posted here modified version, which didn't put "\n" after the last case (made specially), but it got AC PE. Now, I turned back to _as you said_ version, and it got ACCEPTED!!
Thank you!
Now I lay me down to sleep...
my profile
my profile
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10466 - How Far?
Input:
AC output:
Code: Select all
3 5
20 5
30 5
40 5
10 10
20 1
30 2
40 3
50 4
60 5
70 6
80 7
90 8
100 9
110 10
Code: Select all
20.0000 50.0000 90.0000
20.0000 50.0000 45.8258 40.0000 52.9150 26.4575 67.6432 119.3608 163.2869 202.1349
Check input and AC output for thousands of problems on uDebug!
-
- New poster
- Posts: 4
- Joined: Thu Mar 08, 2012 8:11 am
Re: 10466 - How Far?
Code: Select all
AC :)