17 条题解
- 1
信息
- ID
- 2144
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 2
- 标签
- 递交数
- 447
- 已通过
- 259
- 上传者
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,i;
double sum=0,sum1=0;
cin>>a;
while (a>1){
if(a%2==0){
a=a/2;
sum=sum+1;
}
else{
a=3*a+1;
sum1=sum1+1;
}
}
cout<<sum1+sum;
}
#include<bits/stdc++.h> using namespace std; int main(){ int a,i; double sum=0,sum1=0; cin>>a; while (a>1){ if(a%2==0){ a=a/2; sum=sum+1; } else{ a=3*a+1; sum1=sum1+1; } } cout<<sum1+sum; }
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,i;
double sum=0,sum1=0;
cin>>a;
while (a>1){
if(a%2==0){
a=a/2;
sum=sum+1;
}
else{
a=3*a+1;
sum1=sum1+1;
}
}
cout<<sum1+sum;
}
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,i;
double sum=0,sum1=0;
cin>>a;
while (a>1){
if(a%2==0){
a=a/2;
sum=sum+1;
}
else{
a=3*a+1;
sum1=sum1+1;
}
}
cout<<sum1+sum;
}
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,i;
double sum=0,sum1=0;
cin>>a;
while (a>1){
if(a%2==0){
a=a/2;
sum=sum+1;
}
else{
a=3*a+1;
sum1=sum1+1;
}
}
cout<<sum1+sum;
}
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,i;
double sum=0,sum1=0;
cin>>a;
while (a>1){
if(a%2==0){
a=a/2;
sum=sum+1;
}
else{
a=3*a+1;
sum1=sum1+1;
}
}
cout<<sum1+sum;
}
#include<bits/stdc++.h> using namespace std; int main(){ int a,i; double sum=0,sum1=0; cin>>a; while (a>1){ if(a%2==0){ a=a/2; sum=sum+1; } else{ a=3*a+1; sum1=sum1+1; } } cout<<sum1+sum; }
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,num=0;
cin>>n;
while(n!=1){
if(n%2==0) n = n/2;
else n = 3*n+1;
num++;
}
cout<<num;
return 0;
}
#include<bits/stdc++.h> using namespace std; int main(){ int n,sum=0; cin>>n; while(n!=1){ if(n%2==1) n=3*n+1; else n=n/2; sum=sum+1; } cout<<sum; return 0; }
#include<bits/stdc++.h> using namespace std; int main(){ int n,num=0; cin>>n; while( n!=1){ if(n%2==0) n=n/2; else n = 3*n+1; num++; } cout<<num; return 0; }
#include<bits/stdc++.h> using namespace std; int main(){ int a,cnt=0; cin>>a; while(1!=a){ if(a%2==0) a=a/2; else a=a*3+1; cnt++;} cout<<cnt; }
#include<bits/stdc++.h> using namespace std; int main(){ int n,d; double sum=0,sum1=0; cin>>n; while(n>1){ if(n%2==0){ n=n/2; sum=sum+1; d++; } else{ n=n*3+1; sum1=sum1+1; d++; } } cout<<sum+sum1; return 0; }
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,i;
double sum=0,sum1=0;
cin>>a;
while (a>1){
if(a%2==0){
a=a/2;
sum=sum+1;
}
else{
a=3*a+1;
sum1=sum1+1;
}
}
cout<<sum1+sum;
}
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,i;
double sum=0,sum1=0;
cin>>a;
while (a>1){
if(a%2==0){
a=a/2;
sum=sum+1;
}
else{
a=3*a+1;
sum1=sum1+1;
}
}
cout<<sum1+sum;
}
#include<bits/stdc++.h> using namespace std; int main(){ int a,i; double sum=0,sum1=0; cin>>a; while (a>1){ if(a%2==0){ a=a/2; sum=sum+1; } else{ a=3*a+1; sum1=sum1+1; } } cout<<sum1+sum; }
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,i;
double sum=0,sum1=0;
cin>>a;
while (a>1){
if(a%2==0){
a=a/2;
sum=sum+1;
}
else{
a=3*a+1;
sum1=sum1+1;
}
}
cout<<sum1+sum;
}