10220 - I Love Big Numbers !

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

Moderator: Board moderators

zsepi
Learning poster
Posts: 51
Joined: Thu Sep 26, 2002 7:43 pm
Location: Easton, PA, USA

10220 wa confused

Post by zsepi »

i honestly don't know what could be wrong with my solution - i pregenerate the factorials (0! -> 1000! - not even stripping the zeros from the end), calculate the sums of the digits, the program runs in time (less than a second), but still it's wa.... there cannot be tricky cases, the standard input works fine, so do my handchecked examples... Is there a trick in the format of the input I missed? I mean, is the following description correct?
Input: one integer for each test case, input ends with EOF
Output: one integer per line
thanx in advance for ur help
Dealing with failure is easy: Work hard to improve.
Success is also easy to handle: You've solved the wrong problem. Work hard to improve.

hager
New poster
Posts: 10
Joined: Wed Jan 01, 2003 4:26 am
Location: Ume

Post by hager »

It sounds like you're doing it right, and if you've handled the special case
of 0! correctly, there isn't much I can think of. You could post the code or send it to me and I'll be happy to check it for you.

Best regards

Trinity
New poster
Posts: 12
Joined: Tue Jun 10, 2003 3:40 pm

Post by Trinity »

OK!

I`m not here to answer your question, but to make one...
Which king of variable did you use to keep the answer of the factorial.. I mean... its a pretty big number and I can`t make it work, well the biggest factorial I can answer is 25, rsrsrs...
Did you make a different way to work with that giant number??

Thanx Trinity

Zhao Le
Learning poster
Posts: 80
Joined: Mon May 05, 2003 4:09 am
Location: Shanghai,China

10220

Post by Zhao Le »

Can any one tell me the way how can speed up the #10220?

I got TLE. :(
AC makes me feels good,
But WA makes me thinks hard.

Joseph Kurniawan
Experienced poster
Posts: 136
Joined: Tue Apr 01, 2003 6:59 am
Location: Jakarta, Indonesia

Post by Joseph Kurniawan »

You can use precalc method for this problem.
For your reference see problem 324 - 500!

Master
Learning poster
Posts: 82
Joined: Thu Oct 10, 2002 1:15 pm
Location: St. Johns, Canada
Contact:

Post by Master »

Obeviously this is a big integer problem and the precalculation is must for this problem.

jhonny_yang
New poster
Posts: 22
Joined: Fri Jan 17, 2003 8:24 am

Re: TLE 10220.

Post by jhonny_yang »

Zhao Le wrote:Can any one tell me the way how can speed up the #10220?

I got TLE. :(
using array only 10000 , save the result into the array. that's linear time

boshkash1986
New poster
Posts: 21
Joined: Tue Jan 10, 2006 12:25 am

10220 - I Love Big Numbers !

Post by boshkash1986 »

My solution runs in reasonable ammount of time but i get wrong answer i tried every possible answer but i always got WA
can anyone help with test case that can determine whether my code runs correctly or not

(Note : i tried 0!)


thanks alot for your help

boshkash1986
New poster
Posts: 21
Joined: Tue Jan 10, 2006 12:25 am

Post by boshkash1986 »

can not anyone help me

Please

Mohammad Mahmudur Rahman
Experienced poster
Posts: 154
Joined: Sat Apr 17, 2004 9:34 am
Location: EEE, BUET

Post by Mohammad Mahmudur Rahman »

0 is most probably not in the judge input. However, here are some I/O for your testing.

Code: Select all

1
2
3
6
10
62
88
299
400
619
987
1000
Output->

Code: Select all

1
2
6
9
27
306
531
2448
3402
5841
10206
10539
You should never take more than you give in the circle of life.

boshkash1986
New poster
Posts: 21
Joined: Tue Jan 10, 2006 12:25 am

Post by boshkash1986 »

thanks alot for your help
I had a small bug and i fixed it and i got AC

thanks again for your help

Raiyan Kamal
Experienced poster
Posts: 106
Joined: Thu Jan 29, 2004 12:07 pm
Location: Bangladesh
Contact:

Post by Raiyan Kamal »

Thanks Mahmud vai ! Small mistakes make such a big mess.

kana
New poster
Posts: 19
Joined: Mon Mar 13, 2006 6:03 pm
Location: dhaka

Post by kana »

i've tried the test cases and my code outputs 10215 for input - 987. :o

can anyone help me with the ouptout of 987!. plz

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan »

I think I havent understood your question right. The output for 987 is 10206, which was posted by Mohammad Mahmudur Rahman. But if you want to know the value of 987! then PM me.
Ami ekhono shopno dekhi...
HomePage

Scarecrow
Learning poster
Posts: 69
Joined: Wed Oct 19, 2011 9:06 pm

Re: 10220 - I Love Big Numbers !

Post by Scarecrow »

i cant figure it out why i'm getting RE..seems no error.i used almost the same code for 623 - Factorial Frequencies and got AC. but here incresed the string sizes as needed and getting RE! plz can any1 help me.. :(

Code: Select all

removed after AC
Do or do not. There is no try.

Post Reply

Return to “Volume 102 (10200-10299)”