### Re: 294 please help me

Posted:

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

Page **6** of **7**

Posted: **Tue Jul 17, 2012 12:32 am**

Try the input little joey posted in this thread.

Posted: **Thu Sep 27, 2012 6:17 pm**

Please Help me providing Sample I/O. I'm getting WA but can't figure it out

Thanks.

Thanks.

Posted: **Thu Sep 27, 2012 10:46 pm**

You can generate your own at

http://www.uvatoolkit.com/problemssolve.php

http://www.uvatoolkit.com/problemssolve.php

Posted: **Thu Mar 28, 2013 7:27 pm**

input
output

Code: Select all

```
5
1 0
1 1
2 2
3 3
12 18
```

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.
```

Posted: **Mon May 27, 2013 11:38 pm**

Posted: **Wed May 29, 2013 12:04 am**

Try increasing the size of your status array by one.

Posted: **Tue Dec 03, 2013 7:00 pm**

why WA? couldnt find out!!

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

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

Posted: **Tue Dec 03, 2013 11:37 pm**

Try running your code on the sample input

Posted: **Wed Dec 04, 2013 10:02 am**

oh.i didnt notice it . but my compiler was always giving correct output for sample input while other compilers were not!brianfry713 wrote:Try running your code on the sample input

thanx a lot

Posted: **Thu Feb 13, 2014 7:03 am**

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

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
```

Posted: **Thu Feb 13, 2014 11:30 pm**

Try solving it without using floating point.

Posted: **Sun Feb 16, 2014 1:44 pm**

wellbrianfry713 wrote:Try solving it without using floating point.

after reading u're advise

i got AC

thanks a lot reallyyyyyy

btw I wonder why floating point causes problems

Posted: **Thu Dec 04, 2014 7:25 pm**

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;
}
```