Page 2 of 2

10699

Posted: Tue Aug 15, 2006 8:04 am
by Iffat
i got run time error and following msg:

Your program has died with signal 8 (SIGFPE). Meaning:

Floating point exception

:( :( :( :(

Code: Select all

#include<stdio.h>
#define MAX 1000050


int main()
{	
	long long  n,N,i,count,arr[MAX];
	long  long t,s=0,k,j,q;
	for(i=2;i*i<=1000000;i++)
		{
			t=1;
			if(i==2){t=1;}
			if((i%2)==0&&(i!=2))t=0;
			else
			{
				for(j=3;j*j<=i;j+=2)
				{
					if((i%j)==0)t=0;
				}
			}
			if(t==1)
			{	
				s++;
				arr[s]=i;
				
			}
		}  
	while(1)
	{
		scanf("%lld",&N);
	
		if(N==0)break;
		count=0;	
		
		for(q=1;arr[q]<N;q++)
		{
			if((N%arr[q])==0)count++;
		}
		
		printf("%lld : %lld\n",N,count);
	}
	return 0;
}
pzzz help me ... :( :( :(

Re: 10699

Posted: Tue Aug 15, 2006 11:42 am
by Martin Macko
Iffat wrote:i got run time error and following msg:

Your program has died with signal 8 (SIGFPE). Meaning:

Floating point exception
You have foud primes only up to 1000 and not up to 10^6. Therefore, your array arr[] is not initialised after first few numbers.

Re: 10699

Posted: Tue Aug 15, 2006 11:44 am
by Martin Macko
And btw, there is already a thread on this problem. If there is a thread on a particular problem, please, use it to post your question and do not create a new one. (see http://online-judge.uva.es/board/viewto ... ight=10699, http://online-judge.uva.es/board/viewto ... ight=10699 and http://online-judge.uva.es/board/viewto ... ight=10699)
forum 'Volume CVI' description wrote:All about problems in Volume CVI. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

10699 WA why

Posted: Wed Jul 18, 2007 4:35 pm
by tolgaulusoy
Does anybody know tricky testcase?

my testcase :
  • 2
    3
    1000000
    700001
    6
    1
    10
    500000
    500001
    123456
    987651
    11
    999999
    1000001
    700001
    999999
    438444
    78498
    564231
    0
and output :
  • 2 : 1
    3 : 1
    1000000 : 2
    700001 : 1
    6 : 2
    1 : 0
    10 : 2
    500000 : 2
    500001 : 2
    123456 : 3
    987651 : 4
    11 : 1
    999999 : 5
    700001 : 1
    999999 : 5
    438444 : 4
    78498 : 4
    564231 : 3

Posted: Tue Jul 24, 2007 8:52 am
by jainal cse du

Code: Select all

please give me what is the different prime factors for following input:

289384
930887
692778
636916
747794
238336
885387
760493
516650
641422


Posted: Tue Jul 24, 2007 2:11 pm
by abdullah<cse du>
Jainal,

My accepted code gives the following output.

289384 : 3
930887 : 2
692778 : 5
636916 : 4
747794 : 3
238336 : 3
885387 : 2
760493 : 2
516650 : 3
641422 : 3

Hope this will help you.
ABDULLAH.

Thanks

Posted: Fri Dec 21, 2007 2:14 am
by mohsincsedu
I got ACC:)

Thanks to Martin Macko


The running time is 0.020 ...
how way i can improve my running time.....



thanks in advanced..

Re: 10699 - Count the Factors

Posted: Thu Jun 23, 2011 10:53 am
by plamplam
Consider these cases:

Code: Select all

2
4
18
95918
874211
942561
179550
529165
897750
840840
510510
0

Code: Select all

2 : 1
4 : 1
18 : 2
95918 : 3
874211 : 2
942561 : 2
179550 : 5
529165 : 4
897750 : 5
840840 : 6
510510 : 7

Re: 10699 - Count the Factors

Posted: Fri Jan 25, 2013 3:28 pm
by kier.guevara

Code: Select all

 got AC
Just forgot to include the number itself to check as a prime

Re: 10699 - Count the Factors

Posted: Sat Apr 12, 2014 7:16 am
by uDebug
plamplam wrote:Consider these cases:
Thanks for sharing.

Re: 10699 - Count the factors

Posted: Thu Jan 15, 2015 6:53 am
by Tahanima
I'm getting wrong answer with this code. Can anyone please help me out?

Code: Select all

deleted the code as got AC

Re: 10699 - Count the factors

Posted: Fri Jan 16, 2015 12:26 am
by brianfry713
999983 : 1

Re: 10699 - Count the factors

Posted: Sat Jan 17, 2015 11:18 am
by Tahanima
Got AC. Thank you. :D