|
|
вернуться в форумWhy wrong answer ? c++ Послано Daniel 12 окт 2011 12:20 #include <iostream> #include <cmath> #include <iomanip> #include <stdio.h> using namespace std; int main() {
int i; float A[256*1024/4];
for( i=0; i<65536; i++) //scanf("d%",A[i]); A[i]=0+rand()%256;
for(i=65536; i>=0; i--) { if ( A[i]>=0 && A[i]<= pow(float(10),18) ) { std::cout.precision(4); std::cout<<fixed<<sqrt(A[i]); } else return 0;
}
return 0; } Re: Why wrong answer ? c++ use array size 256*1024/2 = 131072 "for( i=0; i<65536; i++)" is wrong. because they can also input only 2 integers as input. |
|
|