9 条题解

  • 3
    @ 2023-9-30 20:21:31

    全网最简AC13行代码,点个赞吧,求求了!


    #include <iostream>
    using namespace std;
    int main()//经典开头好习惯
    {
        int h=100,a=1;//初始化
        while(h>=0.5)//判断循环
        {
            h/=2;//100不断除以二
            a++;//每除以一次次数加1
        }
        cout<<a;//输出
        return 0;//结尾
    }
    

    对于上面的老六,我只能单走一个9(6翻了)

    
    
    • @ 2023-10-3 20:37:15
      #include<bits/stdc++.h>
      using namespace std;int main(){double n=100,m;while(n>=0.5){n/=2;m++;}cout<<m;return 0;}
      

      你说啥

    • @ 2024-1-18 19:14:30

      @ 格式侠

    • @ 2024-6-14 22:30:48

      1行

      #include<bits/stdc++.h> using namespace std;int main(){double n=100,m;while(n>=0.5){n/=2;m++;}cout<<m;return 0;}
      
  • 2
    @ 2023-7-29 20:54:40
    #include <bits/stdc++.h>
    using namespace std;
    int x=100;
    int main()
    {
        for(int i=1;i<=10;i++)
        {
            if(x<0.5)
            {
                cout<<i;
                break;
            }
            x/=2.0;
        }
        return 0;
    }
    
    • 2
      @ 2023-7-18 20:01:31
      #include <bits/stdc++.h>
      using namespace std;
      int main(){
          cout << 8;
      }
      
      #include <bits/stdc++.h>
      using namespace std;
      int main(){
      	double n = 100, num = 0;
      	while(n >= 0.5){
      		n /= 2;
      		num++;
      	}
      	cout << num;
      } 
      
      • 2
        @ 2023-7-7 13:14:14

        #include <iostream> using namespace std; int main() { double i = 100; int num = 0; while (i >= 0.5) { i /= 2; num++; } cout << num; return 0; }

        • 2
          @ 2022-12-23 14:35:40
          #include <iostream>
          using namespace std;
          int main()
          {
              cout << 8 << endl;
              return 0;
          }
          
        • 1
          @ 2023-10-3 20:38:17

          两行

          #include<bits/stdc++.h>
          using namespace std;int main(){double n=100,m;while(n>=0.5){n/=2;m++;}cout<<m;return 0;}
          
          • 1
            @ 2023-10-3 20:34:11
            #include<bits/stdc++.h>
            using namespace std;
            int main()
            {
                double n=100,m;
                while(n>=0.5)
                {
                    n/=2;
                    m++;
                }
                cout<<m;
                return 0;
            }
            
            • 1
              @ 2023-4-22 14:44:12
              #include <bits/stdc++.h> 
              using namespace std;
              int main()
              {
                  int n = 100, num = 1;
                  while(n >= 0.5)
                  {
                      n /= 2;
                      num++;
                  }
                  cout << num;
                  return 0;
              }
              
              • 1
                @ 2023-4-15 9:16:26
                #include<bits/stdc++.h>
                using namespace std;
                int ans;
                int main()
                {
                    for (double i=100;i>=0.5;i/=2)//这里记得用double
                        ans++;
                    cout<<ans;
                    return 0;
                }
                • 1

                信息

                ID
                63
                时间
                1000ms
                内存
                16MiB
                难度
                2
                标签
                递交数
                277
                已通过
                160
                上传者