Page 2 of 2

Posted: Wed Dec 05, 2007 4:10 pm
by pineapple
you are welcome!
you had ever helped me on some nasty problems.
I am testing and optimizing my ac codes for the problems I solved,found the precision is the main trouble in the new system.
no one can get ac on P216 now,it is an easy backtracking problem.
I think it must be a classical sample.

Re: 10751 - Chessboard

Posted: Sat Nov 22, 2008 11:16 am
by chchwy
notice 2 things
1. print "4" digit after demical point
2. "blank line" : print blank line "between" every output case.

sample output code

Code: Select all

for(int i=0;i<times;++i){
    //calculate the path length
    printf ("%.4f\n", path_length);
    if( i != times-1) printf("\n");   //dont print \n after the last case
}

Re: 10751 - Chessboard

Posted: Thu Mar 28, 2013 12:53 am
by mehdiii
I checked it for small n, then I found a pattern, but I have no proof for it.

Input :

Code: Select all

10
1
2
3
4
5
6
7
8
9
10
Output :

Code: Select all

0.000

4.000

9.414

17.657

28.728

42.627

59.355

78.912

101.296

126.510

Re: 10751 - Chessboard

Posted: Thu Mar 28, 2013 9:36 pm
by brianfry713
Your I/O is correct. Printing 3 digits after the decimal point is enough, printing 4 is also fine.

Re: 10751 - Chessboard

Posted: Mon Nov 04, 2013 8:32 am
by sadmansobhan

Code: Select all

 Code removed after AC

Re: 10751 - Chessboard

Posted: Tue Nov 05, 2013 1:39 am
by brianfry713
Print a blank line between test cases. Don't print an extra blank line at the end.

Re: 10751 - Chessboard

Posted: Tue Nov 05, 2013 8:31 pm
by sadmansobhan
@brianfry713 thanks for your precious hints. I had one other severe fault and for that my code missed some digits after decimal point. My fault was to taking datatype -

Code: Select all

 float
but the correct approach is to print the answer as

Code: Select all

 double
. Thanks again :wink: