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 its gvng wrong answer?
Posted by tanu 20 Mar 2011 10:41
#include<iostream>
#include<vector>
#include<cmath>

using namespace std;

int main(){
double x;
int i=0;
double a[100];
while(cin>>x)
{
a[i]=(sqrt(x));
i++;
}

for(int j=i-1;j>=0;j--)printf("%.4f\n",a[i]);
return 0;
}
Re: why its gvng wrong answer?
Posted by bsu.mmf.team 20 Mar 2011 15:44
1) Change double to long double. 10^18 is much more, than double type can contain.
2) The size of your array may be greater than 100.