can anyone help me telling why im getting wrong answer?????
# include <stdio.h>
int main()
{
long long n,i,j,m,k,l,number;
for(scanf("%lld %lld",&i,&j);i || j;scanf("%lld %lld",&i,&j))
{
m=0;
k=i;
for(k;k<=j;k++)
{
l=k;
for(n=1;;n++)
{
if(l%2!=0)
l=3*l+1;
else
l=l/2;
if(l==1 ...
Search found 6 matches
- Sat Dec 31, 2011 7:28 am
- Forum: Volume 3 (300-399)
- Topic: 371 - Ackermann Functions
- Replies: 196
- Views: 51118
- Sat Dec 31, 2011 7:24 am
- Forum: Volume 107 (10700-10799)
- Topic: 10773 - Back to Intermediate Math
- Replies: 41
- Views: 23864
Re: 10773 - Back to Intermediate Math
if d=0 then how it is possible to determine two different paths?????
- Sat Dec 17, 2011 8:35 am
- Forum: Volume 101 (10100-10199)
- Topic: 10170 - The Hotel with Infinite Rooms
- Replies: 20
- Views: 12409
Re: 10170 - The Hotel with Infinite Rooms
now i get it......the prob is in sqrt(n)*sqrt(n)......
- Sat Dec 17, 2011 8:30 am
- Forum: Volume 109 (10900-10999)
- Topic: 10921 - Find the Telephone
- Replies: 23
- Views: 13128
Re: runtime error in 10921
ya thanx......i got it.....
- Fri Dec 16, 2011 11:06 am
- Forum: Volume 101 (10100-10199)
- Topic: 10170 - The Hotel with Infinite Rooms
- Replies: 20
- Views: 12409
Re: 10170 - The Hotel with Infinite Rooms
why WA??
i tried many test cases and all came out correctly????then why WA???
here is my code.....
# include <math.h>
# include <stdio.h>
int main()
{
long long a,s,n,d;
while(scanf("%lld",&a)==1)
{
scanf("%lld",&s);
d=2*a-1;
d=d*d+8*s;
n=(-(2*a-1)+sqrt(d))/2;
if(d==sqrt(d)*sqrt(d ...
i tried many test cases and all came out correctly????then why WA???
here is my code.....
# include <math.h>
# include <stdio.h>
int main()
{
long long a,s,n,d;
while(scanf("%lld",&a)==1)
{
scanf("%lld",&s);
d=2*a-1;
d=d*d+8*s;
n=(-(2*a-1)+sqrt(d))/2;
if(d==sqrt(d)*sqrt(d ...
- Thu Dec 15, 2011 5:00 pm
- Forum: Volume 109 (10900-10999)
- Topic: 10921 - Find the Telephone
- Replies: 23
- Views: 13128
runtime error in 10921
why do i get a runtime error in this code...
# include <stdio.h>
# include <string.h>
int main()
{
char a[30];
int i,j;
while(gets(a))
{
j=strlen(a);
for(i=0;i<j;i++)
{
if(a >64 && a <=67)
a ='2';
else if(a >67 && a <=70)
a ='3';
else if(a >70 && a <=73)
a ='4';
else if(a >73 && a[i ...
# include <stdio.h>
# include <string.h>
int main()
{
char a[30];
int i,j;
while(gets(a))
{
j=strlen(a);
for(i=0;i<j;i++)
{
if(a >64 && a <=67)
a ='2';
else if(a >67 && a <=70)
a ='3';
else if(a >70 && a <=73)
a ='4';
else if(a >73 && a[i ...