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

Common Board

TO ADMIN....PROBLEMS WITH NEW C++ JUDGE SYSTEM
Posted by Igor Dex 14 Dec 2003 03:46
Dear Admin,
I've just received "WA" to the solution of the problem 1084.
The solution is easy. There can't be any arguments about that.
The problems seem to be with the output of real numbers in the new
system. I use #include<iostream> #include<iomanip> and namespase std;
and after that some commands to format the output.
Such methods were enough to be accepted in the task from 1002...1061
where output with real numbers of some accuracy were required.
What has been changed now?
A lot of people would be grateful for the explanations.
Thanks in advance.
The "WA" program is included.

#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;

const double PI=3.14159265358979323846;

int main()
{
    double L, R, S;
    double alpha , betta;
    cin >> L >> R;

    if ( R < L/2. ) S = (PI * R * R )/2.;
    else if ( R*R > 0.5*L*L) S = L * L;
    else
    {
        alpha = acos( L/(2.*R) );
        betta = PI/2. - 2.* alpha;
        S = R * (L/2.) * sin (alpha);
        S += ( betta * R * R )/2.;
        S *= 4.;
    }
    cout.setf(ios_base::showpoint);  // cout << showpoint
    cout.setf(ios_base::fixed, ios_base::floatfield);// cout << fixed;
    cout.precision(3);                // cout << setprecision(3);
    cout << S << endl;
    return 0;
}
Re: TO ADMIN....PROBLEMS WITH NEW C++ JUDGE SYSTEM
Posted by Igor Dex 14 Dec 2003 05:25
Well, I encountered the same "accuracy" problem
in 1075(Of course, I took into considereation all possible positions
of the thread and a sphere).


> Dear Admin,
> I've just received "WA" to the solution of the problem 1084.
> The solution is easy. There can't be any arguments about that.
> The problems seem to be with the output of real numbers in the new
> system. I use #include<iostream> #include<iomanip> and namespase
std;
> and after that some commands to format the output.
> Such methods were enough to be accepted in the task from
1002...1061
> where output with real numbers of some accuracy were required.
> What has been changed now?
> A lot of people would be grateful for the explanations.
> Thanks in advance.
> The "WA" program is included.
>
> #include<iostream>
> #include<math.h>
> #include<iomanip>
> using namespace std;
>
> const double PI=3.14159265358979323846;
>
> int main()
> {
>     double L, R, S;
>     double alpha , betta;
>     cin >> L >> R;
>
>     if ( R < L/2. ) S = (PI * R * R );
>     else if ( R*R > 0.5*L*L) S = L * L;
>     else
>     {
>         alpha = acos( L/(2.*R) );
>         betta = PI/2. - 2.* alpha;
>         S = R * (L/2.) * sin (alpha);
>         S += ( betta * R * R )/2.;
>         S *= 4.;
>     }
>     cout.setf(ios_base::showpoint);  // cout << showpoint
>     cout.setf(ios_base::fixed, ios_base::floatfield);// cout <<
fixed;
>     cout.precision(3);                // cout << setprecision(3);
>     cout << S << endl;
>     return 0;
> }
>