|  | 
|  | 
| вернуться в форум | Wrong answer Послано ZiDo  15 сен 2012 20:44Pleas Assist=)#include <iostream>
 #include <math.h>
 #include <iomanip>
 using namespace std;
 int main()
 {
 
 double arr[32768];
 int i=0;
 double value=0;
 while(cin>>value)
 {
 if (value>0)
 {
 arr[i++]=sqrt(value);
 value=0;
 }
 else break;
 
 }
 cout<<setprecision(4)<<fixed;
 while(i--)
 {
 cout <<arr[i]<<endl;
 }
 system("pause");
 
 }
 
 Edited by author 15.09.2012 23:36
Re: Wrong answer First of all the amount of numbers are about 129000 but not 32768 as you have written.Re: Wrong answer Right, but if you're using C++ why not use a dynamic container like std::vector.   If you don't know STL it's worth learning at least the STL containers.  vector, map, and set in particular are immensely useful and bring C++ up to "higher" level language status than C++ without them.   They're especially useful when you don't know the input limits beforehand because they grow automatically.
 Edited by author 18.09.2012 13:41
Re: Wrong answer Послано Sunnat  3 окт 2012 00:15#include<iostream>#include<math.h>
 using namespace std;
 #pragma comment(linker, "/STACK:2000000")
 void worc(){
 double k;
 if(scanf("%lf",&k)!=EOF){
 worc();
 printf("%.4lf\n",sqrt(k));
 }
 }
 int main()
 {
 worc();
 return 0;
 }
 | 
 | 
|