Page 2 of 3
Posted: Thu May 01, 2003 1:27 pm
you don't consider the case that cnt<0, for example input 2 8.

Posted: Thu May 01, 2003 3:06 pm
Oh, Yes , I neglected this point, Now I got AC
Thank you very much Posted: Fri May 16, 2003 2:00 am
As far i know according to the way u make a array of primes
must 101 after 97...... but u made 101 cheak it
int primes = {
2,
3,
5,
7,
11,
13,
17,
19,
23,
29,
31,
37,
41,
43,
47,
53,
59,
61,
67,
71,
73,
79,
83,
89,
97,
111 };

### Well

Posted: Fri May 16, 2003 3:42 am
I guess, you don't have all prime numbers - what about number 101?

### Why WA!

Posted: Tue Jun 10, 2003 6:41 pm
I keep getting WA. Any help appreciated!

{\$N+}
Const
p: array [1..25] of byte=
(2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97);

Var
i: byte;
n,d,t: longint;
r: extended;
pn: array [1..25] of byte;

Begin
While (n<>0) or (d<>0) do
begin
if d<0 then d:= -d;
if (n<d) and (d<>1) then
begin
writeln(output,0);
continue;
end;
fillchar(pn,sizeof(pn),1); r:= 1;
for i:= 1 to 25 do
begin
t:= p;
While (t<100) do
begin
Inc(pn,n div t);
t:= t*p;
end;
end;
for i:= 1 to 25 do
While (d mod p= 0) do
begin
d:= d div p;
Dec(pn);
end;
for i:= 1 to 25 do
r:= r*pn;
if d= 1 then writeln(output,r:0:0)
else writeln(output,0);
end;
End.
[/pascal]

Posted: Tue Jun 10, 2003 9:04 pm
hi peir,

i am not a pascal programmer. but what i can understand to see your code,
you don't consider the case that cnt<0, for example input 2 8.

and again what in your code is :

if (n<d) and (d<>1) then
begin
writeln(output,0);
continue;
end;

what should be the answer for the input: 10 12
does your code show the right output ??? output will be -> 168.

hi jalal,

for this program , i don't think prime 101 is essential.
so that will not make any harm for this program.
as the maximum input of n for this program is 100.

### 10484 Divisibility of Factors

Posted: Mon Jul 14, 2003 6:05 am
I got WA many times....

Are there some critical input data?

P.S) If it help to adviser, I'll post my WA source code here.

Posted: Mon Jul 14, 2003 7:21 am
Becarefull D can be negative value, and don't forget use long long.

As I know there are no tricky input here.
If you still can't get AC, send me your code I'll try to help. Posted: Tue Jul 15, 2003 3:44 pm
First, I used long long data type... Anyway, Thanks for youe reply. But I have a question.

If D is negative number, then I write

if( D < 0 ) D *= -1;

Is it right?

Please tell me... Posted: Tue Jul 15, 2003 4:32 pm
soyoja vai,

your code (mentioned in your last submission ) seems right to me.

you can try for the input below

input:
2 16
output:
0

i have got 1 WA for this input first time.

### 10484 - Never mind it

Posted: Wed Sep 17, 2003 7:12 am
Could anybody help me??
I got WA all the time.

Here's my code:
[c]
????????????????
[/c]

Never mind!!  Posted: Tue Oct 14, 2003 8:49 am
Red Scorpion wrote:Becarefull D can be negative value, and don't forget use long long.

As I know there are no tricky input here.
If you still can't get AC, send me your code I'll try to help. i am sure that there is no input with d<0 because i when i ran my code it gave different ans for d<0 and d>0 but got ac by judge.

### 10484- runtime error...can any one help

Posted: Tue Jun 15, 2004 7:35 pm
hi... can any state why i am getting runtime error watching the following code...i dont have some condition which can result to WA... but can't get why this error is occuring...

my code :

Code: Select all

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

void divisible_generator();
void input_divisible(long long int);
long long int b,a,counter;
void main()
{
long long int i,j,k,n,m,c;

divisible_generator();
for(;;)
{
scanf("%lld %lld",&n,&m);
break;

if(n==0&&m==0)	break;
else
{
input_divisible(m);k=c=1;

for(i=0;i<counter;i++)
{
if(a[n][b[i]]>0)
{
if(a[b[i]]>0)
if(a[b[i]]>a[n][b[i]])	{c=0;break;}
else 	j=a[n][b[i]]-a[b[i]];

else	j=a[n][b[i]]+1;

k*=j;
}
else if(a[b[i]]>0&&a[n][b[i]]==0)		{c=0;break;}
}
if(c==0)	printf("0\n");
else	printf("%lld\n",k);
}
}
}

void divisible_generator()
{
long long int i,j,k,n;
for(i=1;i<=100;i++)
{n=i;
for(j=1;j<=100;j++)
a[i][j]=a[i-1][j];
for(;n>1;)
for(k=2;k<=n;k++)
if(n%k==0)
{a[i][k]++;n/=k;break;}
}

for(j=1,counter=0;j<=100;j++)
if(a[i-1][j]>0)
{b[counter]=j;
counter++;
}
}

void input_divisible(long long int n)
{
long long int i,j,k;
for(j=1;j<=100;j++)
a[j]=0;

for(;n>1;)
for(k=2;k<=n;k++)
if(n%k==0)
{a[k]++;n/=k;break;}

}``````

### still getting...runtime...

Posted: Tue Jun 15, 2004 7:51 pm
i pointed out... the -ve may lead to runtime error as invalid memory location.. so changed..

if(m<0) m=-m;

still cant solve the runtime error can any 1 help...

Posted: Thu Jul 08, 2004 11:33 am
Hi, these are my sample input/output:

input:
0 -10
0 -5
0 -1
0 1
0 5
0 10
1 0
1 -1
1 1
1 -2
1 2
2 -4
2 -3
2 -2
2 -1
2 0
2 1
2 2
2 3
2 4
3 -8
3 -7
3 -6
3 -5
3 -4
3 -3
3 -2
3 -1
3 0
3 1
3 2
3 3
3 4
3 5
3 6
3 7
3 8
12 -18
13 15
18 29
25 -25
80 17
80 1
80 2
100 2
100 3
100 11
100 -1
100 1
0 0
my output:
0
0
1
1
0
0
0
1
1
0
0
0
0
1
1
0
1
1
0
0
0
0
1
0
0
2
2
3
0
3
2
2
0
0
1
0
0
480
880
0
242880
94133433139200
117666791423999
116177338368000
38603278909440000
38205306961920000
35101125771264000
39001250856959999
39001250856959999
is my output ok?