10751 - Chessboard

All about problems in Volume 107. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

pineapple
Learning poster
Posts: 57
Joined: Fri Nov 03, 2006 3:33 pm

Post by pineapple » Wed Dec 05, 2007 4:10 pm

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.

chchwy
New poster
Posts: 2
Joined: Sat Nov 22, 2008 10:45 am

Re: 10751 - Chessboard

Post by chchwy » Sat Nov 22, 2008 11:16 am

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
}

mehdiii
New poster
Posts: 9
Joined: Fri Nov 02, 2012 1:35 pm

Re: 10751 - Chessboard

Post by mehdiii » Thu Mar 28, 2013 12:53 am

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

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10751 - Chessboard

Post by brianfry713 » Thu Mar 28, 2013 9:36 pm

Your I/O is correct. Printing 3 digits after the decimal point is enough, printing 4 is also fine.
Check input and AC output for thousands of problems on uDebug!

sadmansobhan
New poster
Posts: 16
Joined: Thu Oct 10, 2013 8:06 am

Re: 10751 - Chessboard

Post by sadmansobhan » Mon Nov 04, 2013 8:32 am

Code: Select all

 Code removed after AC
Last edited by sadmansobhan on Tue Nov 05, 2013 8:32 pm, edited 1 time in total.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10751 - Chessboard

Post by brianfry713 » Tue Nov 05, 2013 1:39 am

Print a blank line between test cases. Don't print an extra blank line at the end.
Check input and AC output for thousands of problems on uDebug!

sadmansobhan
New poster
Posts: 16
Joined: Thu Oct 10, 2013 8:06 am

Re: 10751 - Chessboard

Post by sadmansobhan » Tue Nov 05, 2013 8:31 pm

@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:

Post Reply

Return to “Volume 107 (10700-10799)”