Search found 2 matches

by jacksh
Sat Aug 19, 2006 3:05 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 318193

thank you

thank you
by jacksh
Thu Aug 17, 2006 9:47 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 318193

WHY ?

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

Go to advanced search