|  | 
|  | 
| вернуться в форум | How to make my solution so fast on C++? #include <stdio.h>#include <math.h>
 #include <stdlib.h>
 
 void main()
 {
 int i = 0;
 int k;
 double b;
 double *a = (double*)malloc(sizeof(double)*1000000);
 while(scanf("%lf",&b) != EOF)
 {
 a[i] = sqrt(b);
 i++;
 }
 for(k = i - 1;k >= 0; k--)
 {
 printf("%.4lf\n",a[k]);
 }
 
 }
Re: How to make my solution so fast on C++? Use block i/o but better use Pascal:))
 Edited by author 31.01.2007 02:08
Re: How to make my solution so fast on C++? I don't understand what did you say... What does it mean block i/o?P.S. The same solution on Pascal work 0.125 sec
Re: How to make my solution so fast on C++? Special optimization is needed on Pascal for 0.125You solution on Pascal is very good
Re: How to make my solution so fast on C++? why you save sqrt () of value?you can save value b like __int64 and later print sqrt() of it
 I suppose it get less memory that double
 | 
 | 
|