Page 6 of 7

Re: 294 please help me

Posted: Tue Jul 17, 2012 12:32 am
by brianfry713
Try the input little joey posted in this thread.

Re: 294 please help me

Posted: Thu Sep 27, 2012 6:17 pm
by sophi
Please Help me providing Sample I/O. I'm getting WA but can't figure it out
Thanks.

Re: 294 please help me

Posted: Thu Sep 27, 2012 10:46 pm
by brianfry713
You can generate your own at
http://www.uvatoolkit.com/problemssolve.php

294 please help me

Posted: Thu Mar 28, 2013 7:27 pm
by shipu_a
input

Code: Select all

5
1 0
1 1
2 2
3 3
12 18
output

Code: Select all

Between 1 and 1, 0 has a maximum of 2 divisors.
Between 1 and 1, 1 has a maximum of 1 divisors.
Between 2 and 2, 2 has a maximum of 2 divisors.
Between 3 and 3, 3 has a maximum of 2 divisors.
Between 12 and 18, 12 has a maximum of 6 divisors.

Re: 294 please help me

Posted: Mon May 27, 2013 11:38 pm
by hello
got RTE ....but don't know why.....

Code: Select all

Remove after AC
[code]

Re: 294 please help me

Posted: Wed May 29, 2013 12:04 am
by brianfry713
Try increasing the size of your status array by one.

Re: 294 - Divisors WA!!!

Posted: Tue Dec 03, 2013 7:00 pm
by X123
why WA? couldnt find out!!
:roll:

my code-

#include<stdio.h>
#include<math.h>
int divisor(int n)
{
int i,div;
double sqrtn;
if(n==1)
return 1;
else if(n==2)
return 2;
else{
div=2;
sqrtn=sqrt(n);
for(i=2;i<sqrtn;i++)
{
if(n%i==0)
{
div=div+2;
}
}
if(sqrtn*sqrtn==n)
div++;
return div;
}
}

int main() {
int n,div,max=0,U,L,T,a=1,maxn;
scanf("%d",&T);
while(a<=T)
{

scanf("%d %d",&L,&U);
max=0;

for(n=L;n<=U;n++)
{
div=divisor(n);

if(div>max){
maxn=n;
max=div;
}
}
printf("Between %d and %d, %d has a maximum of %d divisors.\n",L,U,maxn,max);
a++;
}
return 0;
}

help pls :(

Re: 294 - Divisors WA!!!

Posted: Tue Dec 03, 2013 11:37 pm
by brianfry713
Try running your code on the sample input

Re: 294 - Divisors WA!!!

Posted: Wed Dec 04, 2013 10:02 am
by X123
brianfry713 wrote:Try running your code on the sample input
oh.i didnt notice it . but my compiler was always giving correct output for sample input while other compilers were not!

thanx a lot :)

Re: 294 - Divisors WA!!!

Posted: Thu Dec 05, 2013 12:41 am
by brianfry713

Re: 294 please help me

Posted: Thu Feb 13, 2014 7:03 am
by bobSHIH
hello everyone
is there someone could help me?
I have got over 10 WA
and i have read the other reply on board
but i still can't figure out why i got WA?
here is my code

Code: Select all

GOT AC

Re: 294 please help me

Posted: Thu Feb 13, 2014 11:30 pm
by brianfry713
Try solving it without using floating point.

Re: 294 please help me

Posted: Sun Feb 16, 2014 1:44 pm
by bobSHIH
brianfry713 wrote:Try solving it without using floating point.
well
after reading u're advise
i got AC
thanks a lot reallyyyyyy

btw I wonder why floating point causes problems :o

Re: 294 please help me

Posted: Tue Feb 18, 2014 8:28 pm
by brianfry713

Re: 294 - Divisors

Posted: Thu Dec 04, 2014 7:25 pm
by ssavi
How Can I Optimize My Code ????? Please Someone help ..... v1n1t sir / Brainfry sir please ???

Code: Select all

#include<stdio.h>
int main()
{
    long long int u, l, i, j, count, max, t, d;
    scanf("%lld",&t);
    while(t--)
    {
         max=0;
        scanf("%lld %lld",&u, &l);
        for(i=u;i<=l;i++)
        {
            count=0;
            j=i;
            while(j>=1)
            {
                if((i%j)==0)
                  count++;
                j--;
            }
            if(count>max)
            {
                max=count;
                d=i;
            }
        }
        printf("Between %lld and %lld, %lld has a maximum of %lld divisors.\n",u, l, d, count);
    }
    return 0;
}