| 
 | 
back to boardWho can tell me why my programme is wrong? It seem to be so simple and I think is should be right. #include<stdio.h> //Who can tell me why my programme is wrong? It seem to be so //simple and I think is should be right. #define Max(a,b) (a>b?a:b)   typedef long double type;   double N; type H1,H2;   int main() { float a;   type i;  scanf("%lf %f",&N,&a); H1=(type)a; H2=0;  for (i=2; i<=N; i++) H2=Max(H2,(H1*(i-2)-(i-1)*(i-2))/(i-1));  printf("%0.2lf\n",(double)Max(0,H2*(N-1)-H1*(N-2)+(N-1)*(N-2)));  return 0; }  |  
  | 
|