|
|
back to boardWrong Answer test 1 WHY??? #include <cstdlib> #include <iostream> #include <math.h> #include <iomanip>> using namespace std; double *qntd = NULL; short n,i; int main(int argc, char *argv[]) { cin >> n; qntd = new double [n];
for (i = 0; i < n; i++) { cin >> qntd[i]; } for (i = n-1;i > -1; i--) { cout << setprecision(4)<<fixed << sqrt(qntd[i]) <<'\n'; }
system("PAUSE"); return EXIT_SUCCESS; } Re: Wrong Answer test 1 WHY??? //#include <cstdlib> //superfluous library #include <iostream> #include <math.h> #include <iomanip> using namespace std; double *qntd = NULL; int /*n,*/i=0; //cin is stream (no n) //short is too short int main(int argc, char *argv[]){ // cin >> n; qntd = new double [256*1024]; //memory 256KB /* for (i = 0; i < n; i++) //cin is stream (no n) { cin >> qntd[i]; } */ while(cin>>qntd[i++]); for (i-=2;i>=0;i--) cout << setprecision(4)<<fixed << sqrt(qntd[i]) << endl; system("PAUSE"); return EXIT_SUCCESS; } Edited by author 28.05.2009 20:14 |
|
|