hello to all you guys out there
i am a newbie to ACM
and i after i going to solve my first problem today
in http://acm.uva.es/p/v1/100.html
i write a program and i think it works corectly
but the Judge say me wrong answer wrong answer.....
i would be grateful if you helping me
tanx in advance
-----------------------------------
#include <iostream.h>

void main()
{
        int a,b,counter,max,index,temp,i;
        while (cin>>a>>b)
        {
                index  = a;
                max = 0;

                for(i=a;i<=b;i++)
                {
                        counter= 0;
                        temp = i;
                        while(temp!=1)
                        {
                                counter++;
                                if((temp%2)==1)
                                        temp= 3 * temp + 1;
                                else
                                {
                                if((temp%2)==0)
                                        temp= temp/2 ;
                                }

                        }
                        counter++;

                        if(counter >= max)
                        {
                                max=counter;
                                index = i;
                        }
                        
                }
                cout<<a<<" "<<b<<" "<<max<<endl;
        }
}


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to