ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1001. Обратный корень

Why is WA for Test 9? Pls. Help me.
Послано logic 21 авг 2008 13:36
#include<stdio.h>
#include<math.h>
int main()
{
     double a[100000];
     signed long int i = 0;
     while (scanf("%lf", &a[i]) != EOF)
     {
         i++;
     }
     i--;
     while ( i >= 0)
     {
         printf("%.4lf\n",sqrt(a[i]));
         i--;
     }
     return ;
}
Re: Why is WA for Test 9? Pls. Help me.
Послано Danshin Anton (LIOD Orenburg) 14 сен 2008 14:30
!!!!!EXTENDED for Pascal!!!!!!
!!!!!LONG DOUBLE for C++!!!!!!
Re: Why is WA for Test 9? Pls. Help me.
Послано nikonoff (ONPU) 22 сен 2008 19:02
try this:
double a [128*1024]
Re: Why is WA for Test 9? Pls. Help me.
Послано Aleksa_Markoni 23 ноя 2008 01:32
use dinamic memory try
double *a = (double *) malloc (sizeof(double)*128*1024);
and when you done before return
free (a);
thats all :)
Re: Why is WA for Test 9? Pls. Help me.
Послано fa2f 20 дек 2008 00:37
Aleksa_Markoni, thank you!
Re: Why is WA for Test 9? Pls. Help me.
Послано yangqiang 31 мар 2009 07:12
Could you tell me why it should use dinamic memory ?
Thank you!
Re: Why is WA for Test 9? Pls. Help me.
Послано chinagdjdlyd 6 окт 2009 08:40
There is no need to use dinamic memory ...
Just make sure that your array is large enough.
But I wonder why the result I get is TLE ...
this is my code:
#include<stdio.h>
#include<string.h>
#include<math.h>

double a[100010];//make it larger and then I got AC

int main()
{
    int k=0;
    while(scanf("%lf",&a[k])!=EOF)k++;
    while(k)
        printf("%.4lf\n",sqrt(a[--k]));

    return 0;
}
Aleksa_Markoni писал(a) 23 ноября 2008 01:32
use dinamic memory try
double *a = (double *) malloc (sizeof(double)*128*1024);
and when you done before return
free (a);
thats all :)
Re: Why is WA for Test 9? Pls. Help me.
Послано icanwin 6 окт 2009 21:16


Edited by author 21.10.2009 00:40
Re: Why is WA for Test 9? Pls. Help me.
Послано rachelwang 4 мар 2010 12:59
while your program submit
it replies Time limit exceeded
for what reason?