Problem - A - Codeforces

i was solving this question..

using dynamically allocated memory as well as declaring arrays..

in both methods

after i give the input..

input : 3 10 1000

0 10

**program is not responding (it is crashing)**

i dunno why please help me..

the code is (i feel i followed a indent style )

Code:

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
long int n;
float a,d,v_check,d_check,t_check,d_temp,t_temp; //v_check uses
int i;
float t_initial[1000],v[1000],t_final[1000];
v_check=(float)sqrt(2*a*d);
scanf("%d%f%f",&n,&a,&d);
/*t_initial=(int *)malloc(n*sizeof(int));
t_final=(int *)malloc(n*sizeof(int));
v=(int *)malloc(n*sizeof(int));*/
for(i=1;i<=n;i++)
{
t_initial[i]=0;
t_final[i]=0;
v[i]=0;
}
for(i=1;i<=n;i++)
{
scanf("%f%f",t_initial[i],v[i]);
}
for(i=1;i<=n;i++)
{
if(v_check>v[i])
{
t_check=(float)v[i]/a;
d_check=(float)(a*t_check*t_check);
}
d_temp=(float)(d-d_check);
t_temp=(float)d_temp/v[i];
t_final[i]=(float)(t_initial[i]+t_check+t_temp);
}
for(i=1;i<=n;i++)
{
if(t_final[i]>t_final[0]&&t_final[i]>t_initial[0])
{
t_final[i]=(float)t_final[0];
}
}
for(i=1;i<=n;i++)
{
printf("%f\n",t_final[i]);
}
getch();
}