Search found 3 matches

by Teapot
Wed Nov 24, 2004 1:39 pm
Forum: Volume 107 (10700-10799)
Topic: 10780 - Again Prime? No Time.
Replies: 40
Views: 34635

Thanks a lot guys! I got AC now.
by Teapot
Tue Nov 23, 2004 9:23 pm
Forum: Volume 107 (10700-10799)
Topic: 10780 - Again Prime? No Time.
Replies: 40
Views: 34635

Ok. Thanks for your help.
I did not describe idea, because I thought it's pretty simple.
I've used the definition of a factorial.
I check numbers from m to n with step m. And calculate number of dividers equal m (a power of m). Then I add these numbers. Resulting sum is the largest power of m.

It ...
by Teapot
Tue Nov 23, 2004 12:12 pm
Forum: Volume 107 (10700-10799)
Topic: 10780 - Again Prime? No Time.
Replies: 40
Views: 34635

10780 - Again Prime? No Time.

Why WA?

[c]#include <stdio.h>

int getDevidersNumber(int a, int b)
{
int i = 0;
while (0 == (a % b)) {
a = a / b;
i++;
}
return i;
}

int main(void)
{
int i, j, N, m, n, pow;
scanf("%d", &N);
for (i = 1; i <= N; i++) {
scanf("%d %d", &m, &n);
printf("Case %d:\n", i);
if (n == 1 ...

Go to advanced search