Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a,b,j,i,x,c=0,m=0;
- unsigned int n;
- while(cin >> a >> b)
- {
- if(a>b){
- swap(a,b);
- }
- for(i=a; i<=b; i++)
- {
- n=i;
- while(n!=1)
- {
- else if(n%2!=0)
- n=(n*3)+1;
- else if(n%2==0)
- n = n/2;
- c++;
- }
- m=max(m,c);
- c=0;
- }
- cout << a << " " << b << " " << m << endl;
- m=0;
- n=0;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement