~cpp //1. 3n+1 [[[[AOI]]]] #include<iostream.h> int check(int n); void main() { int n1; // 1 int n2; // 2 int max=0; //길 길 . cout<<" ( .n1<n2 )"<<endl; cin>>n1; cin.get(); cin>>n2; int temp = n2; for(int i= n2-n1 ; i >=0 ; i--) { if(check(temp)>max) max = check(temp); temp--; } cout<<""<<n1<<"과"<<n2<<" 길"<<max<<"."<<endl; } int check(int n)// 길 { int count = 1;// 길 while(n!=1) { int temp = n%2; if(temp==0)//temp값 .. n = n/2; else //temp값 .. n = ((3*n)+1); count++; } return count; }