ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1001. Reverse Root

Wrong Answer test 1 WHY???
Posted by Herushion 7 May 2009 02:07
#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;
}
Try sample test
Posted by Vladimir Yakovlev (USU) 13 May 2009 01:29
Re: Wrong Answer test 1 WHY???
Posted by Paradox(Petrosyan Alexandr){RAU}~ 28 May 2009 19:53
//#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