11 条题解

  • 2
    @ 2024-2-16 16:14:59

    Python的哦~

    x=int(input())
    i=1
    while True:
        i+=1
        if 3**i<=x<3**(i+1):
            print(i)
            break
    
    • 1
      @ 2023-7-16 17:59:59
      #include <iostream>
      #include<cmath>
      using namespace std;
      int n;
      int main(){
          cin>>n;
          for (int i=0;i<=1000;i++){
              int a=pow(3,i);
              int b=pow(3,i+1);
              if(n>=a&&n<b){
                  cout<<i;
                  break;
              }
          }
          return 0;
      }
      

      c++

      • 0
        @ 2025-3-17 11:21:05

        包对 #include <bits/stdc++.h> using namespace std; int main() { int n,m=1; cin>>n; for(int i=0;i<=10000;i++){ if(n<m){ cout<<i-1; break; } m=m*3; } return 0; }

        • 0
          @ 2025-3-11 15:07:52

          #include <bits/stdc++.h>

          using namespace std;

          int main() { int n,t=3,a=0; cin>>n; while (n>=t) { t*=3; a++; } cout <<a; return 0;

          }

          • 0
            @ 2025-3-4 15:54:16

            #include #include #include using namespace std; int a,c,b; int main() { cin>>a; b=1; while (a>=b) { b*=3; c++; } if (c!=0) { cout<<c-1; } else { cout<<c; } return 0; }

            • 0
              @ 2025-2-28 12:27:09
              a=int(input())
              for i in range(1,a):
                  if 3**i<=a and 3**(i+1)>a:
                      print(i)
                      break
              
              • 0
                @ 2025-2-22 21:13:31

                import math n = int(input()) k = int(math.floor(math.log(n, 3))) print(k)

                • 0
                  @ 2024-3-7 14:10:52

                  print(int(math.log(int(input()),3)))#最前面加上import math

                  • 0
                    @ 2023-10-17 15:04:25

                    python

                    a=int(input())
                    b=1
                    flag=True
                    while flag:
                        if 3**b<=a<3**(b+1):
                            flag=False
                        else:
                            b+=1
                    print(b)
                    
                    • 0
                      @ 2023-7-17 12:15:00
                      #include <bits/stdc++.h>
                      
                      using namespace std;
                      long long n,k=1;
                      int main()
                      {
                          cin>>n;
                          while(pow(3,k)>n || pow(3,k+1)<=n){
                              k=k+1;
                          }
                          cout<<k;
                          return 0;
                      }
                      
                      • -4
                        @ 2025-2-15 22:32:37

                        a=int(input()) b=0 while b**3<a: b+=1 print(b-1)

                        • 1

                        信息

                        ID
                        50
                        时间
                        1000ms
                        内存
                        128MiB
                        难度
                        3
                        标签
                        递交数
                        506
                        已通过
                        285
                        上传者