10478 - The Falling Pillars

All about problems in Volume 104. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

helpless
New poster
Posts: 3
Joined: Mon Oct 20, 2003 5:05 am
Location: bangladesh

Post by helpless »

i think the problem is interesting. problem statement is clear.
Towhid
New poster
Posts: 38
Joined: Wed May 28, 2003 5:30 pm
Location: Bangladesh
Contact:

Post by Towhid »

Well, I agree with helpless. It's a nice & interesting prob. And I didn't find anything not clear. Of course there r some cases but all of them r mentioned in the statement.
From 0 to 0
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Post by sohel »

Read the question carefully. And if you are not an expert in geometry you will find this problem very hard.
Caesum
Experienced poster
Posts: 225
Joined: Fri May 03, 2002 12:14 am
Location: UK
Contact:

Post by Caesum »

Can someone give the output for this case:

10 7.99 4 4

thanks
Caesum
Experienced poster
Posts: 225
Joined: Fri May 03, 2002 12:14 am
Location: UK
Contact:

Post by Caesum »

nevermind, thats not a good example of what i was looking for.......
is it possible that as successive blocks fall on each other then one block misses the corner of the one to the right and ends up resting on the underside of the the one to its right ? anyway my code should handle this case but its still wa......
shahriar_manzoor
System administrator & Problemsetter
Posts: 399
Joined: Sat Jan 12, 2002 2:00 am

hmm

Post by shahriar_manzoor »

Have u considered the case when all the pillars stand straight.
nikhil
New poster
Posts: 11
Joined: Wed Oct 08, 2003 1:37 pm

specify???

Post by nikhil »

Can any one tell mee abot any resource or yet at least any primary topic
which will be helpful???
i read the statement and the discussion
unfortunately still in problem
regards
nikhil
Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:

Post by Dominik Michniewski »

Could anyone help me and say, why this code is wrong ? I don't like to post codes, but I think that from amthematical point of view it should be OK, but maybe I'm wrong or I missed something ...

Best regards
DM

Code: Select all

#include <stdio.h>
#include <math.h>

#define MAX   10

int main(void)
{
   double n,d,h,w,alfa[MAX],z,PI;
   int N,k,i,unstable,impossible;

   scanf("%d",&N);
   PI = acos(-1.0);
   for(k=0;k<N;k++)
   {
      impossible = unstable = 0;
      if(scanf("%lf %lf %lf %lf",&n,&d,&h,&w) != 4) break;
      alfa[0] = acos((d-w)/h);
      if((d <= w) || (h < d-w)) impossible = 1;
      if(!impossible)
         for(i=1;i<n-1;i++)
         {
            z = w/sin(alfa[i-1]);
            alfa[i] = alfa[i-1] - asin((d - z)*sin(PI - alfa[i-1])/h);
            if(!unstable)
               if(PI/2.0-alfa[i] < atan(w/h)) unstable = 1;
         }
      printf("Case %d:\n",k+1);
      if(impossible)
         printf("Impossible.\n");
      else
      {
         if(unstable) printf("Unstable Situation.\n");
         for(i=0;i<n-1;i++) printf("%.3lf\n",alfa[i]*180.0/PI);
      }
   }                    
   return 0;
}
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)
Adrian Kuegel
Guru
Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany

Post by Adrian Kuegel »

You got the special cases wrong; here is my special case handling:
if (d<w) {
printf("Impossible.\n");
continue;
}
if (d == w) {
for (i=1; i<n; i++)
printf("90.000\n");
continue;
}
if (d-w>=h) {
for (i=1; i<n; i++)
printf("0.000\n");
continue;
}
Post Reply

Return to “Volume 104 (10400-10499)”