|  | 
|  | 
| back to board | help me 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 Ну тогда тренируйса будит чудеса и получеш AC | 
 | 
|