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

Why wrong answer ? c++
Posted by Daniel 12 Oct 2011 12:20
#include <iostream>
#include <cmath>
#include <iomanip>
#include <stdio.h>
using namespace std;
int main()

{

    int  i;
   float A[256*1024/4];

    for( i=0; i<65536; i++)
        //scanf("d%",A[i]);
        A[i]=0+rand()%256;

    for(i=65536; i>=0; i--)
    {
        if ( A[i]>=0 && A[i]<= pow(float(10),18) )
        {
            std::cout.precision(4);
            std::cout<<fixed<<sqrt(A[i]);
        }
        else
        return 0;

    }



    return 0;
}
Re: Why wrong answer ? c++
Posted by Ajeet Shah 20 Oct 2011 15:34
use array size 256*1024/2 = 131072
"for( i=0; i<65536; i++)" is wrong.
because they can also input only 2 integers as input.