Page 55 of 93
Posted: Sat Jul 29, 2006 11:11 am
by abhi
well ok ... i still dont know if u have got AC but anyway this is the problem
Code: Select all
The integers i and j must appear in the output in the same order in which they appeared in the input
your code doesnt do it because you swap the two integers. it prints i and j in non decreasing order for each case.
Posted: Sat Jul 29, 2006 1:41 pm
by sml
abhi wrote:well ok ... i still dont know if u have got AC but anyway this is the problem
Code: Select all
The integers i and j must appear in the output in the same order in which they appeared in the input
your code doesnt do it because you swap the two integers. it prints i and j in non decreasing order for each case.
Yeah, this caught me, too. Made me learn to read and reread the problems before submitting, but there are still some evil ones out there that assume you're doing very strict management of the input, which is annoying.
Posted: Sat Aug 05, 2006 3:40 pm
by newton
898989 wrote:Salamo Aleko
One of the ways to get ac is to check on range on fly
make a function that get a cycle of a number
Then in main() procees directly on the range.....Then try to solve 371
i do not understand you. plz make it easier to be understood.
Posted: Sat Aug 05, 2006 5:30 pm
by jtmh
Instead of computing all the cycle lengths in advance, compute one only when necessary.
100 problem WA
Posted: Wed Aug 16, 2006 5:35 pm
by ksjones
I
Posted: Wed Aug 16, 2006 6:18 pm
by kolpobilashi
i think you are "xtremely" new!! when there is a
sticky about any problem then creating a new thread is a kind of crime..besides you should read all the previous posts before posting a new one.if you want to find previous posts go to the search option.
and for this problem just look at the top of this volume.there's a huge no. of discussions waiting to help you!!!

WHY ?
Posted: Thu Aug 17, 2006 9:47 am
by jacksh
why it isWA?
#include<iostream>
using namespace std;
long int fun(long int n,long int i)
{
if(n==1)return i;
if(n%2==0)
return fun(n/2,i+1);
else return fun(3*n+1,i+1);
}
int main()
{
long int a,b;
int max=1;
while(cin>>a>>b)
{
if(a>b){
long int temp;
temp=a;
a=b;
b=temp;
}
for(int i=a;i<=b;++i)
{
long int j;
j=fun(i,1);
if(max<j)max=j;
}
cout<<a<<" "<<b<<" "<<max<<endl;
}
return 0;
}
Posted: Thu Aug 17, 2006 9:55 am
by mf
WA in #100 problem
Posted: Fri Aug 18, 2006 12:12 am
by David Buzatto
Hi!
I already posted my problem, but i did
Posted: Fri Aug 18, 2006 3:43 am
by Darko
There can be a case where n1 > n2. Print them before you swap them.
Posted: Fri Aug 18, 2006 5:28 pm
by David Buzatto
Hi Darko. I tried to do what you said but it didn
Posted: Fri Aug 18, 2006 7:40 pm
by Darko
Why do you go from n1+1 to n2? why not from n1?
Posted: Fri Aug 18, 2006 7:55 pm
by David Buzatto
Darko, you were right!
Thanx!
thank you
Posted: Sat Aug 19, 2006 3:05 am
by jacksh
thank you
What version of Java is supported?
Posted: Sun Aug 20, 2006 1:32 pm
by trantri
Hello everybody,
Do you know what version of Java is supported by the robot? In the problem 100, I use String.split() method and it always complain "Compile error", but when I change to use StringTokenizer class instead, I get "Accepted".
Thank you