UVA 100 - The 3n + 1 problem UVA • Sep 1, 2020 Problem PDFSolution:#include int main() { int n,m,i,k,j,c,s; while(scanf("%d %d",&n,&m)==2) { s=0; printf("%d %d ",n,m); if(n>m) { k=m; m=n; n=k; } for(i=n;i<=m;i++) { c=1; j=i; while(j>1) { if(j%2==0) j=j/2; else j=(3*j)+1; c++; } if(c>=s) s=c; } printf("%d\n",s); } return 0; } https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/100/100.cpp Tags UVA Competitive Programming Shipu Ahamed Recommended for you UVA UVA 913 - Joana and the Odd Numbers 4 years ago • 1 min read UVA UVA 871 - Counting Cells in a Blob 4 years ago • 3 min read UVA UVA 866 - Intersecting Line Segments 4 years ago • 3 min read