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

help me
Posted by hello world 28 Jul 2008 20:18
I got TLE when I used Java,and got AC used C++..
And another question is what's the meaning of Crash? Stack overflow or buffer overflow ?How can I get AC using my JAVA program?Please help me..thank you!
Here is my java program
import java.io.*;
import java.util.*;
import java.math.*;
import java.text.DecimalFormat;
public class Main{
    static double c[]=new double[500000];
    public static void main(String argsp[]){
        Scanner cin=new Scanner(System.in);
        int i=0,n;
        while(cin.hasNext()){
            c[i++]=cin.nextDouble();
        }
        n=i;
        for(i=n-1;i>=0;i--){
            DecimalFormat df=new DecimalFormat("0.0000");
            System.out.println(df.format(Math.sqrt(c[i])));
        }
    }
}

and my C++ program have got AC..nearly the same as Java
#include <stdio.h>
#include <math.h>
double a[500000];
int main()
{
    int i,n;
    i=0;
    while(scanf("%lf",&a[i++])!=EOF);
    n=i-1;
    for(i=n-1;i>=0;i--)
    printf("%.4lf\n",sqrt(a[i]));
}
Re: help me
Posted by Meni Packeou 14 Aug 2008 21:50
Ну тогда тренируйса будит чудеса и получеш AC