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

People, hello. Please, help me!
Posted by vadimka 27 Feb 2008 16:33
I don't understand this system. It writes: "wrong answer". Who can talk me what's wrong with my program:

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
void f()
{
  float d;
  if (!(cin >> d)) return;
  f();
  d = sqrt(d);
  cout.precision(4);
  cout << d;
  cout << "\n";
}

void main()
{
  f();
}

Thank you very much!
Re: People, hello. Please, help me!
Posted by inkognito 27 Feb 2008 17:32
Change this :{cout.precision(4);
cout << d;
cout << "\n";}
 to:printf("%.4lf\n",d);

Re: People, hello. Please, help me!
Posted by vadimka 27 Feb 2008 18:58
It doesn't work too! (((
Re: People, hello. Please, help me!
Posted by inkognito 27 Feb 2008 19:50
make an array[1000000] of __int64
then reverse it and print!!!
May be there is another better solution, but this work's!!!
Re: People, hello. Please, help me!
Posted by Gomer 4 Mar 2008 15:26
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

void f()
{

double d;//!

if (!(cin >> d)) return;
f();
d = sqrt(d);
cout << d;
cout << "\n";
}
//!
#pragma comment(linker, "/STACK:16777216")

int main()
{

cout.setf(ios::showpoint | ios::fixed);//!
cout.precision(4);
f();
return 0;
}
It works!

Edited by author 04.03.2008 15:28

Edited by author 04.03.2008 15:29