87 条题解

  • 0
    @ 2022-8-21 17:58:59

    核心代码,if..else判断语句

    if(n%8==0)
          //cout输出代码
    else
          //cout输出代码,注意题目要将搬运次数+1
    
    • 0
      @ 2022-8-18 20:39:33

      只写最简代码!

      #include <iostream>
      using namespace std;
      int main()
      { 
          int n;
          cin >> n;
          if (n % 8 == 0)
          {
              cout << n/8;
          }
          else
          {
              cout << n/8+1;
          }
          return 0;
      }
      
      • @ 2022-8-22 8:18:49
        #include<bits/stdc++.h>
        using namespace std;
        int main()
        {
            int a;
            cin>>a;
            if(a%8==0)
            {
                cout<<a/8;
                return 0;
            }
            cout<<a/8+1;
            return 0;
        }
        
        
      • @ 2022-8-22 8:19:10

        这个才是最简@

      • @ 2023-6-15 18:58:44

        @ 这才是最简:

        #include <iostream>
        using namespace std;
        int main()
        {
            int n;
            cin >> n;
            cout << n / 8 + (n % 8 == 0 ? 0 : 1);
            return 0;
        }
        
      • @ 2023-8-22 9:28:27

        @胡说,这才是:

        #include <cstdio>
        int main()
        {int n;scanf("%d", &n);printf("%d", n / 8 + (n % 8 == 0 ? 0 : 1));return 0;}
        
    • 0
      @ 2022-8-10 21:15:19
      #include <iostream>
      using namespace std;
      
      int main()
      {
          int a,b;
          cin>>a;//定义ab输入a
          if (a%8==0)//判断是否是8的倍数
          {
              b=a/8;
          }
          else
          {
              b=a/8+1;
          }
          cout<<b;
          return 0;
      }
      
      • 0
        @ 2022-8-4 19:17:37

        这一道题可以用到进一法来做 首先看看是否能被8整除 能:直接输出整除结果 不能:输出整除结果+1

        #include <bits/stdc++.h>
        using namespace std;
        int main()
        {
            int a;
            cin >> a;
            if (a % 8 == 0)
                cout << a / 8;
            else
                cout << a / 8 + 1;
            return 0;
        }
        
        • 0
          @ 2022-8-3 13:42:07

          有手就行!

          #include <bits/stdc++.h>
          using namespace std;
          int main()
          {
          int n;
          cin >> n;
          if (n % 8 != 0)//如不能刚好运完
          {
          coout << n / 8 + 1;
          }
          else
          {
          cout << n / 8;
          }
          return 0;
          }
          
          • 0
            @ 2022-8-2 19:47:32

            敢敢单单

            #include <iostream> 
            using namespace std;
            int main()
            {
                int n;
                cin >> n;
                if(n % 8 == 0)
                {
                    cout << n / 8;
                }
                else
                {
                    cout << n / 8+1;
                }
                return 0;
            }
            //自己多动脑哦~
            
            • 0
              @ 2022-7-20 11:33:54
              #include <iostream>
              using namespace std;
              int main()
              {
                  int n;
                  cin >> n;
                  if (n%8 == 0)//两种情况:整除8与不整除
                  {
                      cout << n/8;
                  }
                  else//可直接简化为else
                  {
                      cout << n/8+1;
                  }
                  return 0;
              }
              
              • 0
                @ 2022-7-8 10:06:36

                其实有一个更简单的做法~~~

                n / 8的结果的小数点后可能是: 0.0;0.125;0.25;0.375;0.5;0.625;0.75;0.875; 加0.9并取整,得: 0;1;1;1;1;1;1;1 So!The 代码 is:

                #include <iostream>
                using namespace std;
                int main()
                {
                double n;
                cin >> n;
                //核心代码:
                int a = n / 8 + 0.9;
                cout << a;
                return 0;
                }
                
                
              • 0
                @ 2022-7-2 22:15:59

                太简单了,如果是八的倍数那就是这个数,如果不是那就是a/8+1;上代码! #include <iostream> using namespace std; int main() { int a,b; cin>>a; if(a%8==0) { b=a/8; } else { b=a/8+1; } cout<<b; return 0; }

                • 0
                  @ 2022-6-5 11:25:22

                  #include <bits/stdc++.h> using namespace std; int main() { int n,c=0; cin>>n; if(n%8!=0) { cout<<n/8+1; } else if(n%8==0) { cout<<n/8; } }

                  • 0
                    @ 2022-5-26 15:05:19

                    题解:就是判断是否是8的倍数。

                    if(n%8==0){
                           输出商。
                    }else{
                          输出商+1.
                    }
                    
                    • 0
                      @ 2022-4-24 15:49:08

                      鼓励大家写题解,但注意题解格式。

                      给代码两端加上这个会舒服一些

                      ```cpp

                      你的代码

                      ```

                      </span>

                      这个点在键盘的左上角tab上面那个键,注意切换输入法

                      #include<iostream>
                      using namespace std;
                      int main()
                      {
                          int n;
                          cin>>n;//这是一个注释
                          return 0;
                      } 
                      

                      请注意严禁抄袭题解,写题解不要只放代码,需加上你的思路或代码注释。

                      抄袭题解一经发现直接取消成绩。

                      • -1
                        @ 2024-1-17 21:14:51

                        ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... .......................................................................................

                        ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... .......................................................................................

                        ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... .......................................................................................

                        ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... .......................................................................................

                        ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... .......................................................................................

                        ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... .......................................................................................

                        ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... ....................................................................................... .......................................................................................

                        • -1
                          @ 2024-1-17 21:06:38

                          👍

                          • -1
                            @ 2023-11-18 16:52:15
                            #include<bits/stdc++.h>
                            using namespace std;
                            int main()
                            {
                                int a;
                                cin >> a;
                                int b = a / 8;
                                if (a % 8 != 0) b ++;
                                cout << b << endl;
                            	return 0; 
                            }
                            
                            • -1
                              @ 2023-11-12 10:41:38
                              #include<bits/stdc++.h>
                              using namespace std;
                              int main()
                              {
                                  int a;
                                  cin >> a;
                                  int b = a / 8;
                                  if (a % 8 != 0) b ++;
                                  cout << b << endl;
                              	re turn 0; 
                              }
                              
                              • -1
                                @ 2023-10-15 15:30:53

                                #include <iostream> using namespace std; int main() { int n; cin >> n; if (n/8==0) { cout << (n/8); } else if (n%8<8) { cout << (n/8)+1; } return 0; }

                                • -1
                                  @ 2023-8-31 16:37:59

                                  #include <iostream> using namespace std; int main() { int a; cin>>a; if (a%8!=0) { cout<<a/8+1; } else { cout<<a/8; }

                                  return 0;
                                  

                                  }

                                  • -1
                                    @ 2023-8-29 14:35:21
                                    #include <iostream>
                                    using namespace std;
                                    int main()
                                    {
                                        int n;
                                        cin >> n;
                                        if (n % 8 == 0)
                                        {
                                            cout << n / 8;
                                        }
                                        else
                                        {
                                            cout << n / 8 + 1;
                                        }
                                        return 0;
                                    }
                                    
                                    • -1
                                      @ 2023-8-29 14:03:43
                                      #include <iostream>
                                      using namespace std;
                                      int main()
                                      {
                                          int n,b,a;
                                          cin>>n;
                                          a=n%8;
                                          b=(n-a)/8;
                                          if(n%8>=1)
                                          {
                                              b++;
                                          }
                                          cout<<b;
                                          return 0;
                                      }
                                      

                                      信息

                                      ID
                                      1292
                                      时间
                                      1000ms
                                      内存
                                      256MiB
                                      难度
                                      3
                                      标签
                                      递交数
                                      7748
                                      已通过
                                      3955
                                      上传者