17 条题解

  • 8
    @ 2024-3-17 9:58:18
    #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;
    }
    
    • 1
      @ 2024-3-31 9:27:37
      #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;
      }
      
      • 1
        @ 2024-3-17 10:08:22

        #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; }

        • 1
          @ 2024-3-15 21:00:06
          #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;
          }
          
          • 0
            @ 2024-3-24 9:16:57
            #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;
            }
            
            • 0
              @ 2024-3-17 10:30:38
              #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;
              }
              
              • 0
                @ 2024-3-17 10:28:53
                #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;
                }
                
                • 0
                  @ 2024-3-17 10:08:56

                  #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; }

                  • -1
                    @ 2024-3-29 16:20:51
                    #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;
                    }
                    
                    • -1
                      @ 2024-3-23 11:12:31

                      #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; }

                      • -1
                        @ 2024-3-22 16:52:42

                        #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; }

                        • -1
                          @ 2024-3-17 16:43:57

                          #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; }

                          • -1
                            @ 2024-3-17 12:04:49

                            #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; }

                            • -1
                              @ 2024-3-17 10:11:36
                              #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;
                              }
                              
                              • -1
                                @ 2024-3-17 10:10:01
                                #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;
                                }
                                
                                • -2
                                  @ 2024-3-17 10:30:19

                                  #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; }

                                  • -4
                                    @ 2024-3-17 10:28:30
                                    #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;
                                    }
                                    
                                    • 1

                                    信息

                                    ID
                                    2144
                                    时间
                                    1000ms
                                    内存
                                    256MiB
                                    难度
                                    2
                                    标签
                                    递交数
                                    447
                                    已通过
                                    259
                                    上传者