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

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

Moderator: Board moderators

Post Reply
Raj Ariyan
Learning poster
Posts: 70
Joined: Sat Feb 05, 2005 9:38 am
Location: Gurukul

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

Post by Raj Ariyan » Sat Sep 03, 2005 8:43 pm

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
Some Love Stories Live Forever ....

Antonio Ocampo
Experienced poster
Posts: 131
Joined: Sat Jul 17, 2004 4:09 am
Location: Lima, Per

Post by Antonio Ocampo » Sat Sep 03, 2005 9:27 pm

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:

Raj Ariyan
Learning poster
Posts: 70
Joined: Sat Feb 05, 2005 9:38 am
Location: Gurukul

10177

Post by Raj Ariyan » Sat Sep 03, 2005 10:05 pm

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.
Some Love Stories Live Forever ....

Piklu_sust
New poster
Posts: 23
Joined: Fri Sep 01, 2006 10:17 am
Location: CSE, SUST

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

Post by Piklu_sust » Sat Mar 10, 2007 9:42 am

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
Last edited by Piklu_sust on Fri Jun 15, 2007 3:10 pm, edited 2 times in total.

Nazmul Quader Zinnuree
New poster
Posts: 42
Joined: Sun Jul 31, 2005 2:07 am
Location: SUST. Bangladesh
Contact:

Post by Nazmul Quader Zinnuree » Fri Jun 15, 2007 10:51 am

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.

Piklu_sust
New poster
Posts: 23
Joined: Fri Sep 01, 2006 10:17 am
Location: CSE, SUST

Post by Piklu_sust » Fri Jun 15, 2007 2:21 pm

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.

helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

Post by helloneo » Fri Jun 15, 2007 3:00 pm

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

DD
Experienced poster
Posts: 145
Joined: Thu Aug 14, 2003 8:42 am
Location: Mountain View, California
Contact:

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

Post by DD » Sun Nov 16, 2008 5:27 pm

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
Have you ever...
  • Wanted to work at best companies?
  • Struggled with interview problems that could be solved in 15 minutes?
  • Wished you could study real-world problems?
If so, you need to read Elements of Programming Interviews.

bleed1979
New poster
Posts: 8
Joined: Thu Oct 08, 2009 5:34 am

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

Post by bleed1979 » Mon Oct 19, 2009 3:13 am

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.
Judge World - problem solving is a routine.
http://bleed1979.myweb.hinet.net

zhangfei
New poster
Posts: 5
Joined: Thu Jul 29, 2010 2:08 pm

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

Post by zhangfei » Sat Jul 31, 2010 12:57 pm

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;
}

User avatar
plamplam
Experienced poster
Posts: 150
Joined: Fri May 06, 2011 11:37 am

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

Post by plamplam » Sun Oct 30, 2011 10:55 pm

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.
You tried your best and you failed miserably. The lesson is 'never try'. -Homer Simpson

Post Reply

Return to “Volume 101 (10100-10199)”