1
#include<stdio.h>
int main(){
int n,t=0;
scanf("%d",&n);
while(n!=1){
if(n%2==0){
n=n/2;
t++;
}else{
n=(3*n+1)/2;
t++;
}
}
printf("%d\n",t);
return 0;
}
//2
#include<stdio.h>
#include<string.h>
int main(){
char a[110];
int sum=0;
scanf("%s",a);
int l=strlen(a);
for(int i=0;i<l;i++){
sum=sum+a[i]-'0';
}
int t=0;
int b[110];
while(sum){
b[t++]=sum%10;
sum/=10;
}
for(int i=t-1;i>=0;i--){
if(i!=t-1){
printf(" ");
}
if(b[i]==0){
printf("ling");
}else if(b[i]==1){
printf("yi");
}else if(b[i]==2){
printf("er");
}else if(b[i]==3){
printf("san");
}else if(b[i]==4){
printf("si");
}else if(b[i]==5){
printf("wu");
}else if(b[i]==6){
printf("liu");
}else if(b[i]==7){
printf("qi");
}else if(b[i]==8){
printf("ba");
}else{
printf("jiu");
}
}
return 0;
}
//3
#include<stdio.h>
#include<string.h>
int main(){
int n;
scanf("%d",&n);
char s[110];
while(n--){
scanf("%s",s);
int l=strlen(s);
int i=0,a=0,b=-1,c=-1;
while(i<l&&s[i]=='A'){
a++;
i++;
}
if(i<l&&s[i]=='P'){
b=0;
i++;
while(i<l&&s[i]=='A'){
b++;
i++;
}
}
if(i<l&&s[i]=='T'){
c=0;i++;
while(i<l&&s[i]=='A'){
c++;
i++;
}
}
if(a*b==c&&b>=1)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
//4
#include<bits/stdc++.h>
using namespace std;
struct node{
string name,number;
int score;
};
int main(){
int n;
cin>>n;
node q[n];
for(int i=0;i<n;i++){
cin>>q[i].name>>q[i].number;
scanf("%d",&q[i].score );
}
int max=0,min=0;
for(int i=1;i<n;i++){
if(q[i].score>q[max].score ) max=i;
if(q[i].score<q[min].score ) min=i;
}
cout<<q[max].name<<" "<<q[max].number<<endl;
cout<<q[min].name<<" "<<q[min].number<<endl;
return 0;
}
//5
#include<stdio.h>
#include<stdlib.h>
int cmp ( const void *a , const void *b )
{ return *(int *)b - *(int *)a; }
int main(){
int k;
scanf("%d",&k);
int a[k],c[k];
for(int i=0;i<k;i++){
scanf("%d",&a[i]);
c[i]=a[i];
}
for(int i=0;i<k;i++){
while(a[i]!=1){
if(a[i]%2==0)
a[i]/=2;
else
a[i]=(a[i]*3+1)/2;
for(int j=0;j<k;j++){
if(c[j]==0) continue;
if(a[i]==c[j])
c[j]=0;
}
}
}
int d[k],t=0;
for(int i=0;i<k;i++){
if(c[i]!=0) d[t++]=c[i];
}
qsort(d,t,sizeof(int),cmp);
for(int i=0;i<t;i++){
if(i!=0) printf(" ");
printf("%d",d[i]);
}
return 0;
}