623 - 500!

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

Moderator: Board moderators

sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Post by sohel »

800!
77105301133538600.........
987!
43517228134065953.........

these are the first digits!
If you get this right, then I assume the others should be correct too.

And why are you specifically looking for these two outputs.. :-?
sakhassan
Experienced poster
Posts: 105
Joined: Sat Mar 11, 2006 9:42 am
Location: cse,DU

Post by sakhassan »

Thanks for ur half solution ...... I just wanna check whether those input generates correct answer or not
Time that gone is gone forever ...
Debashis Maitra
Learning poster
Posts: 62
Joined: Sun Jul 09, 2006 8:31 am
Location: University of Dhaka
Contact:

Post by Debashis Maitra »

See Art_of_Programming_Contest_SE_for_uva.pdf

for hint
Akash chhoyar swopno
Dream to touch the sky
joebin
New poster
Posts: 12
Joined: Fri Dec 29, 2006 7:18 am
Location: Taiwan
Contact:

623 Got RE?

Post by joebin »

my program ran correctly in Borland C++ BuilderX 1.0 and got the right ans.

I doubt if acm can't use dynamic memory allocation.

or how to declare a 2570x1001 two-dimension array?
Last edited by joebin on Mon Jan 08, 2007 6:23 am, edited 4 times in total.
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan »

Search your problem first. Dont open a new thread unless there is none.
joebin wrote:how to declare a 2570x1001 two-dimension array?
Simply declare it globally.

Code: Select all

#include<...>

int array[2570][1001];

int main()
{
    ...
    return 0;
}
Hope it helps.
Ami ekhono shopno dekhi...
HomePage
joebin
New poster
Posts: 12
Joined: Fri Dec 29, 2006 7:18 am
Location: Taiwan
Contact:

thx!!

Post by joebin »

Now i got AC !!
emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Location: Bangladesh
Contact:

Re: thx!!

Post by emotional blind »

joebin wrote:Now i got AC !!
You should Remove your code now. isnt it?
joebin
New poster
Posts: 12
Joined: Fri Dec 29, 2006 7:18 am
Location: Taiwan
Contact:

remove

Post by joebin »

sorry!!
Last edited by joebin on Mon Jan 08, 2007 6:24 am, edited 1 time in total.
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan »

joebin, I think you haven't understood clearly. After logging in you can edit your post. Select the edit option and remove your code from that post.
Ami ekhono shopno dekhi...
HomePage
emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Location: Bangladesh
Contact:

Post by emotional blind »

It seems Joebin is very much angry with me. :-?
joebin
New poster
Posts: 12
Joined: Fri Dec 29, 2006 7:18 am
Location: Taiwan
Contact:

Post by joebin »

Mm......
not at all
because my english is not good
maybe i misunderstood your reply
sorry!!
emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Location: Bangladesh
Contact:

Post by emotional blind »

joebin wrote:Mm......
not at all
because my english is not good
maybe i misunderstood your reply
sorry!!
Thanks for not posting it again.
diego andres de barros
New poster
Posts: 5
Joined: Mon Jul 10, 2006 3:37 pm

623

Post by diego andres de barros »

please.....where is the error in my input????

#include<stdio.h>

#define MAX 10000

int m[MAX],pos,fix;
const int fixo=1000000;

int mul(int j);


int main(void){

int n,i;

while( scanf("%d",&n) ){
for(i=0;i<=MAX;i++)m=0;
pos=0;

m[0]=1;

for(i=2;i<=n;i++){
m[0]*=i;
fix =(m[0]/fixo);
m[0]=m[0]%fixo;
mul(i);
}//for

printf("%d!\n%d",n,m[pos]);

for(i=pos-1;i>=0;i--){
printf("%.6d",m);
}//for
printf("\n");



}
}//main


int mul(int j){
int i;

for(i=1;i<=pos;i++){
m*=j;
m+=fix;
fix=(m/fixo);
m=m%fixo;
}//for

if( m[pos+1]==0 && fix >0 ){
pos++;
m[pos]=fix;
}


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

Post by helloneo »

There are many threads on this problem..
Don't create a new thread if there is one already..
Md.Arafat Hossain
New poster
Posts: 7
Joined: Fri Mar 02, 2007 10:20 am

RE of 623

Post by Md.Arafat Hossain »

Why it shows runtime error,please help me
Here is my code:
#include<iostream.h>


int main(){
int i,j,k,n,c=0,l,m,s;
int a[1200];

while(cin>>n){
if(n>1){
for(i=0;i<1200;i++)
a=-1;



i=1199;
j=n*(n-1);
while(j>9){
k=j%10;
a=k;
j=j/10;
i--;}
a=j;
for(l=n-2;l>=2;l--){
for(j=1199;j>=i;j--){
k=c+l*a[j];
s=j;
m=k%10;
a[s]=m;
k=k/10;
c=k;}
while(c>9){
m=c%10;
s--;
a[s]=m;
c=c/10;}
if(c>0){
s--;
a[s]=c;}
if(i>s) i=s;
c=0;}
cout<<n<<"!"<<endl;
for(l=i;l<1200;l++)
cout<<a[l];}
else
{if((n==1)||(n==0))
cout<<n<<"!"<<endl<<'1';}
cout<<endl;
}
return 0;}
Post Reply

Return to “Volume 6 (600-699)”