Page 1 of 1

10177 - (2/3/4)-D Sqr/Rects/Cubes/Boxes?

Posted: Sat Sep 03, 2005 8:43 pm
by Raj Ariyan
Hi all,
Please give me correct outputs for the following inputs. Thanks in advance.

Code: Select all

4
5
6
50
100
99
98
10

Posted: Sat Sep 03, 2005 9:27 pm
by Antonio Ocampo
The output with my AC program is

Code: Select all

30 70 100 900 354 9646
55 170 225 3150 979 49646
91 350 441 8820 2275 192206
42925 1582700 1625625 2071046250 65666665 2642590973960
338350 25164150 25502500 128762122500 2050333330 650375455916670
328350 24174150 24502500 121262872500 1950333330 600370555916670
318549 23213652 23532201 114131174850 1854273729 553762629630672
385 2640 3025 163350 25333 9125292
Hope it helps :wink:

10177

Posted: Sat Sep 03, 2005 10:05 pm
by Raj Ariyan
Hi Antonio Ocampo,
Thanks for ur output. Actually my code was correct and matched with your output, but i missed the case n=0. After i edit then got ACC. Thanks again. Bye and good luck.

10177 ((2/3/4)-D Sqr/Rects/Cubes/Boxes?)

Posted: Sat Mar 10, 2007 9:42 am
by Piklu_sust
I found my mistake and got accepted.
Thnx to all viewers.
So i post the correct output for some input and output:

INPUT:
0
4
99
100

OUTPUT:
0 0 0 0 0 0
30 70 100 900 354 9646
328350 24174150 24502500 121262872500 1950333330 600370555916670
338350 25164150 25502500 128762122500 2050333330 650375455916670

Posted: Fri Jun 15, 2007 10:51 am
by Nazmul Quader Zinnuree
Hi,

I haven't tried it yet & have no time to have a try. But, have you tried

Code: Select all

1 0 1 0 1 0
for

Code: Select all

0
?

Don't ask me "WHY ?"......

Thanks.

Posted: Fri Jun 15, 2007 2:21 pm
by Piklu_sust
I haven't tried it yet & have no time to have a try. But, have you tried Code:
1 0 1 0 1 0


for Code:
0


?

Don't ask me "WHY ?"......
Yes. i tried all possible output for input 0. But always got wa.

Posted: Fri Jun 15, 2007 3:00 pm
by helloneo
Most of your output is wrong..

Input:

Code: Select all

0
4
5
6
7
8
9
10
Output:

Code: Select all

0 0 0 0 0 0
30 70 100 900 354 9646
55 170 225 3150 979 49646
91 350 441 8820 2275 192206
140 644 784 21168 4676 609980
204 1092 1296 45360 8772 1670844
285 1740 2025 89100 15333 4085292
385 2640 3025 163350 25333 9125292

Re: 10177 - (2/3/4)-D Sqr/Rects/Cubes/Boxes?

Posted: Sun Nov 16, 2008 5:27 pm
by DD
Since there are some people got A.C. with 0.00 secs, I am curious that is it impossible to got A.C. without off-line pre-computing table? :o

Re: 10177 - (2/3/4)-D Sqr/Rects/Cubes/Boxes?

Posted: Mon Oct 19, 2009 3:13 am
by bleed1979
Time is enough to do pre-calculating without prior to key-in table.

You can think about rectangle = all - square.

It's not hard to AC 0.000s.

Re: 10177 - (2/3/4)-D Sqr/Rects/Cubes/Boxes?

Posted: Sat Jul 31, 2010 12:57 pm
by zhangfei
I have writen down an AC code for this problem. And got a another WA one. But I compared the two 101 outputs, all of them are same. But the second code got WA. Why ?Here I put the second code, anybody can help me?

Code: Select all

#include <stdio.h>
#include <math.h>

int main()
{
#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
#endif
	double n;
	while(scanf("%lf",&n) != EOF)
	{
		printf("%.0lf %.0lf %.0lf %.0lf %.0lf %.0lf\n",
			n*(n+1)*(2*n+1)/6,pow(n*(n+1)/2,2.0)-n*(n+1)*(2*n+1)/6,
			pow(n*(n+1)/2,2.0),pow(n*(n+1)/2,3.0)-pow(n*(n+1)/2,2.0),
			n*(n+1)*(2*n+1)*(3*n*n+3*n-1)/30,pow(n*(n+1)/2,4.0)-n*(n+1)*(2*n+1)*(3*n*n+3*n-1)/30);
	}

	return 0;
}

Re: 10177 - (2/3/4)-D Sqr/Rects/Cubes/Boxes?

Posted: Sun Oct 30, 2011 10:55 pm
by plamplam
Sure thing, avoid doubles at all cost. You get Wrong Answer just because of precision error. You don't even add eps, no wonder you got Wrong asnwer.