ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1001. Reverse Root

what is wrong?
Posted by safeperson 9 Mar 2009 07:21
#include<stdio.h>
#include<math.h>

int main(void)
{
    double a[256*1024/sizeof(double)];

    int i=0;

    while(i < 256*1024/sizeof(double))
    {
        scanf("%lf",&a[i]);

        i++;
    }



    for(--i;i >=0 ; i--)
        printf("%.4lf\n",sqrt(a[i]));




    return 0;



}
Re: what is wrong?
Posted by melkiy 10 Mar 2009 05:14
The number of input numbers can be less than 256*1024. Use the fact that when scanf cannot read next double it returns 0 (it returns the number of successfully read parameters), and break your while then.
Re: what is wrong?
Posted by Discaprio 30 Mar 2009 23:42
just use <stack> from stl