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"?
Posted by Ilya 29 Nov 2018 20:32
#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;

int main(int argc, char const *argv[])
{

    long number;
    double sqrts[256];

    int k = 0;
    while ( cin >> number )
    {
        sqrts[k] = sqrt(number);
        k++;
    }

    for ( int n = k - 1; n > -1; n-- ) {
        cout << fixed << setprecision(4) << sqrts[n] << endl;
    }

    return 0;
}

Edited by author 29.11.2018 20:32
Re: Почему при проверке выбрасывает "Wrong answer"?
Posted by ToadMonster 30 Nov 2018 13:56
http://acm.timus.ru/help.aspx?topic=cpp

C and C++ programs are compiled on the server with the 32-bit Microsoft Visual C++ 2017 or MinGW GCC 7.1 or Clang 4.0.1.

So sizeof(long)==4. You should run locally/debug programs using 32 bit compiler too.

Btw, why do you think 256 sqrts is enough? How did you estimate it?