Page 3 of 5

Re: 11428 - Cubes (about 7 times TLE and 3 times WA)

Posted: Fri Feb 17, 2012 8:27 pm
by sadia_atique
It's still WA,even after changing,what can I do now?someone,please help :(

Re: 11428 - Cubes (about 7 times TLE and 3 times WA)

Posted: Fri Feb 17, 2012 9:31 pm
by brianfry713
1657=24 23

Re: 11428 - Cubes (about 7 times TLE and 3 times WA)

Posted: Sat Feb 18, 2012 7:07 am
by sadia_atique
Thanks a lot,got AC now :D

Re: 11428 - Cubes

Posted: Mon Oct 22, 2012 6:32 pm
by alimbubt
I am getting continuously wrong answer..Please help me......
Here is my code...

#include<stdio.h>
int main()
{
int n,x,y,i,j,flag,m;
while(scanf("%d",&n)==1)
{
if(n==0) break;
x=0;
y=0;
flag=0;
for(j=0;j<=22;j++)
{
for(i=1;i<=28;i++)
{
if(i<j) continue;
m=(i*i*i)-(j*j*j);
if(m==n)
{
x=i;
y=j;
flag=1;
break;
}
}
if(flag==1) break;
}
if(x==0&&y==0)
printf("No solution\n");
else
printf("%d %d\n",x,y);
}
return 0;
}

Re: 11428 - Cubes

Posted: Tue Oct 23, 2012 10:56 pm
by brianfry713
40*40*40-39*39*39=4681

Re: 11428 - Cubes

Posted: Mon Oct 29, 2012 9:42 pm
by alimbubt
brianfry713 wrote:40*40*40-39*39*39=4681
Thanks :D :D

Re: 11428 - Cubes

Posted: Tue Nov 13, 2012 11:24 pm
by mahbub2012
why wrong ans

Code: Select all



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

int main()
{
    double f,t;
    int i,c,n;
    int flag=0;

    while(scanf("%d", &n)==1) {
        if(n==0)
        break;

    for(i=1; ; i++) {
zz:

if(flag == 1)
{i=i+1;
flag=0; }

    f = n + (i*i*i);
    t = cbrt(f);
    c = t;



    if(i>=t)
    break;

    if(c == t)
    {flag = 1;
    break;}  }

    if(n!=((c*c*c)-(i*i*i)) && flag == 1)
    goto zz;

    if(flag == 1)
    { printf("%d %d\n", c,i);
    flag = 0; }

    else
    printf("No solution\n");

}

return 0;
}





Re: 11428 - Cubes

Posted: Wed Nov 14, 2012 1:43 am
by brianfry713
That doesn't match the sample I/O.

Re: 11428 - Cubes

Posted: Wed Jan 23, 2013 10:51 pm
by shuvrothpol1
i've got wa many times.but i check the sample test cases here .can anyone help?
#include <stdio.h>

int main ()
{
long long int n,i,x2,y2,x2y2,flag,alert,j;
scanf ("%lld",&n);
while (n!=0){
j=1;
flag=0;
alert=0;
while (1){
for (i=0;i<j;i++){
x2=j*j;
y2=i*i;
x2y2=x2+y2;
if (x2y2>n){
alert=1;
break;
}
x2y2+=(i*j);
x2y2*=(j-i);
if (x2y2==n){
printf ("%lld %lld\n",j,i);
flag=1;
}
}
if (alert==1)
break;
j++;
}
if (flag==0)
printf ("No solution\n");

scanf ("%lld",&n);
}
return 0;
}

Re: 11428 - Cubes

Posted: Thu Jan 24, 2013 2:36 am
by brianfry713
Try input:

Code: Select all

721
0
AC output:

Code: Select all

9 2

Re: 11428 - Cubes

Posted: Thu Jan 24, 2013 8:24 am
by shuvrothpol1
tnx acceptep..

11428-I am tired getting WA again& again

Posted: Fri Nov 08, 2013 1:54 am
by X123
plz...Help me :oops:

i am just a beginner :(

#include<cstdio>
#include<cmath>
int main()
{
long int t,i,a,N,x=0;
int c;
double p,b;
while(scanf("%ld",&N)==1)
{
if(N==0)
break;
p=sqrt((double)N);
for(i=1;i<=(int)p;i++)
{
a=N+(i*i*i);
b=cbrt((double)a);
c=(int)b;
t=(c*c*c)-(i*i*i);
if(t==N)
{
x=1;
printf("%d %ld\n",c,i);
break;
}
}
if(x==0)
printf("No solution\n");
x=0;
}
return 0;
}

Re: 11428 -Why WA?

Posted: Fri Nov 08, 2013 11:02 am
by X123
plz...Help me

i am just a beginner

[removed]

Re: 11428-I am tired getting WA again& again

Posted: Fri Nov 08, 2013 10:22 pm
by brianfry713
Don't double post

Re: 11428 - Cubes

Posted: Fri Nov 08, 2013 10:28 pm
by brianfry713
Input: 631
Output should be 15 14