87 条题解

  • 0
    @ 2023-8-12 16:45:21
    #include <iostream>
    using namespace std;
    int main()
    {
        int a , b , c;
        cin >> a;
        b = a / 8;
        c = a % 8;
        if (c != 0)
        {
            b += 1;
        }
        cout << b;
        return 0;
    }
    
    • 0
      @ 2023-8-12 16:18:14
      {"messages":{},"UiContext":{"cdn_prefix":"/","url_prefix":"/","ws_prefix":"/","nav_logo_dark":"http://oj.hetao101.com/d/cpp_teacher/file/106/55.png","constantVersion":"e6b2fad1","domainId":"training","domain":{"_id":"training","lower":"training","owner":2,"name":"练习题库","bulletin":"# 核OJ_核桃编程 - 练习题库\r\n\r\n[⇐ 返回根题库](http://oj.hetao101.com/)\r\n\r\n## 基本使用方法\r\n\r\nP 系列题目来自网络,可能会有题目排版数据问题,部分纯输出的题目可能缺少数据,管理员看到缺少数据系统错误的提交后会及时修复。遇到问题可以在讨论区发布帖子。\r\n\r\n1. 通过题库点击某道想做的题目\r\n2. 读题\r\n3. 点击进入在线编程模式\r\n4. 点击右上方的自测打开自测窗口\r\n5. 将题目的样例输入复制进输入框中\r\n6. 点击运行自测,查看是否与输出一致\r\n7. 如果结果没有问题,可以点击递交评测查看评测结果\r\n8. 如果显示错误、可以对应地修改代码再次自测\r\n\r\n![](http://oj.hetao101.com/file/2/t.png)\r\n\r\n## 常见设置\r\n\r\n0. 设置当前题库的显示名:<http://oj.hetao101.com/d/training/home/settings/domain>\r\n1. 进入当前题库的偏好设置页面:<http://oj.hetao101.com/d/training/home/settings/preference>\r\n2. 将显示偏好中的**用户界面语言**设置成**简体中文**\r\n3. 将使用偏好中的**代码语言**设置成自己常用的语言\r\n4. 将使用偏好中的**默认代码模板**改成自己习惯的代码框架,比如下面这段\r\n\r\n```cpp\r\n#include<bits/stdc++.h>\r\nusing namespace std;\r\nint main(){\r\n\r\n\r\n\r\n    return 0;\r\n}\r\n```\r\n","roles":{"3":"10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376","teacher":"10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652777725396788478736373","guest":"10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624967874125500547201","default":"10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652777525100954235143873","root":"-1","cpp":"10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652789254612192640104439","contest_creator":"10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652777526956929862828997","new_teacher":"10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652777543124148872280005"},"avatar":"url:https://ecmb.bdimg.com/tam-ogel/1969563307_-1467192127_88_88.jpg","langs":"cc.std98,cc.std11,cc.std14,py.py3,cc,py","share":"*"},"SWConfig":{"preload":"","hosts":["http://oj.hetao101.com","https://oj.hetao101.com","oj.hetao101.com/","/"],"domains":[]}},"UserContext":"{\"_id\":17475,\"mail\":\"5976915@hetao101.com\",\"uname\":\"hetao5976915\",\"hashType\":\"hydro\",\"priv\":16842756,\"regat\":\"2023-07-12T06:13:59.355Z\",\"loginat\":\"2023-08-01T11:27:44.933Z\",\"perm\":\"BigInt::10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652777525100954235143873\",\"scope\":\"BigInt::-1\",\"role\":\"default\",\"domains\":[],\"tfa\":false,\"authn\":false,\"group\":[\"17475\"],\"timeZone\":\"Asia/Shanghai\",\"codeLang\":\"cc\",\"avatar\":\"gravatar:5976915@hetao101.com\",\"gender\":2,\"backgroundImage\":\"/components/profile/backgrounds/1.jpg\",\"unreadMsg\":0,\"pinnedDomains\":[],\"fontFamily\":\"Open Sans\",\"codeFontFamily\":\"Source Code Pro\",\"preferredEditorType\":\"sv\",\"monacoTheme\":\"vs-light\",\"theme\":\"light\",\"formatCode\":true,\"nAccept\":9,\"nSubmit\":23,\"rp\":5,\"rpInfo\":{\"problem\":5},\"rank\":5740,\"level\":1,\"avatarUrl\":\"//cn.gravatar.com/avatar/dc51bdcf0c080f7680e4d1069ddde2a2?d=mm&s=128\"}"}
      那个大神看看😕 👎 
      
      • 0
        @ 2023-8-12 16:16:19

        😄

        {"messages":{},"UiContext":{"cdn_prefix":"/","url_prefix":"/","ws_prefix":"/","nav_logo_dark":"http://oj.hetao101.com/d/cpp_teacher/file/106/55.png","constantVersion":"e6b2fad1","domainId":"training","domain":{"_id":"training","lower":"training","owner":2,"name":"练习题库","bulletin":"# 核OJ_核桃编程 - 练习题库\r\n\r\n[⇐ 返回根题库](http://oj.hetao101.com/)\r\n\r\n## 基本使用方法\r\n\r\nP 系列题目来自网络,可能会有题目排版数据问题,部分纯输出的题目可能缺少数据,管理员看到缺少数据系统错误的提交后会及时修复。遇到问题可以在讨论区发布帖子。\r\n\r\n1. 通过题库点击某道想做的题目\r\n2. 读题\r\n3. 点击进入在线编程模式\r\n4. 点击右上方的自测打开自测窗口\r\n5. 将题目的样例输入复制进输入框中\r\n6. 点击运行自测,查看是否与输出一致\r\n7. 如果结果没有问题,可以点击递交评测查看评测结果\r\n8. 如果显示错误、可以对应地修改代码再次自测\r\n\r\n![](http://oj.hetao101.com/file/2/t.png)\r\n\r\n## 常见设置\r\n\r\n0. 设置当前题库的显示名:<http://oj.hetao101.com/d/training/home/settings/domain>\r\n1. 进入当前题库的偏好设置页面:<http://oj.hetao101.com/d/training/home/settings/preference>\r\n2. 将显示偏好中的**用户界面语言**设置成**简体中文**\r\n3. 将使用偏好中的**代码语言**设置成自己常用的语言\r\n4. 将使用偏好中的**默认代码模板**改成自己习惯的代码框架,比如下面这段\r\n\r\n```cpp\r\n#include<bits/stdc++.h>\r\nusing namespace std;\r\nint main(){\r\n\r\n\r\n\r\n    return 0;\r\n}\r\n```\r\n","roles":{"3":"10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376","teacher":"10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652777725396788478736373","guest":"10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624967874125500547201","default":"10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652777525100954235143873","root":"-1","cpp":"10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652789254612192640104439","contest_creator":"10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652777526956929862828997","new_teacher":"10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652777543124148872280005"},"avatar":"url:https://ecmb.bdimg.com/tam-ogel/1969563307_-1467192127_88_88.jpg","langs":"cc.std98,cc.std11,cc.std14,py.py3,cc,py","share":"*"},"SWConfig":{"preload":"","hosts":["http://oj.hetao101.com","https://oj.hetao101.com","oj.hetao101.com/","/"],"domains":[]}},"UserContext":"{\"_id\":17475,\"mail\":\"5976915@hetao101.com\",\"uname\":\"hetao5976915\",\"hashType\":\"hydro\",\"priv\":16842756,\"regat\":\"2023-07-12T06:13:59.355Z\",\"loginat\":\"2023-08-01T11:27:44.933Z\",\"perm\":\"BigInt::10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652777525100954235143873\",\"scope\":\"BigInt::-1\",\"role\":\"default\",\"domains\":[],\"tfa\":false,\"authn\":false,\"group\":[\"17475\"],\"timeZone\":\"Asia/Shanghai\",\"codeLang\":\"cc\",\"avatar\":\"gravatar:5976915@hetao101.com\",\"gender\":2,\"backgroundImage\":\"/components/profile/backgrounds/1.jpg\",\"unreadMsg\":0,\"pinnedDomains\":[],\"fontFamily\":\"Open Sans\",\"codeFontFamily\":\"Source Code Pro\",\"preferredEditorType\":\"sv\",\"monacoTheme\":\"vs-light\",\"theme\":\"light\",\"formatCode\":true,\"nAccept\":9,\"nSubmit\":23,\"rp\":5,\"rpInfo\":{\"problem\":5},\"rank\":5740,\"level\":1,\"avatarUrl\":\"//cn.gravatar.com/avatar/dc51bdcf0c080f7680e4d1069ddde2a2?d=mm&s=128\"}"}
        
        • 0
          @ 2023-8-12 14:22:36

          👎

          • 0
            @ 2023-8-12 12:36:16

            一直以为最后一道题会很难,不料竟是送分的!image

            上代码

            #include <bits/stdc++.h>
            using namespace std;
            int main()
            {
            int n;
            cin>>n;
            if(n%8==o)  c0ut<<n/8;
            else  c0ut<<n/8+1;
            return o;
            }
            

            这条代码一点陷阱都没有🎉️

          • 0
            @ 2023-8-12 10:52:58
            #include <iostream>
            using namespace std;
            int main()
            {
                int a;//定义一个存放柴总数的整数变量a。
                cin>>a;//输入柴的总数。
                if (a%8==0)//判断a是否是8的倍数
                {
                    cout<<a/8;
                }
                else//如果a不是8的倍数。
                {
                    cout<<a/8+1;
                }
                return 0;
            }
            
            • 0
              @ 2023-8-10 19:33:02
              #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;
              }
              
              • 0
                @ 2023-8-9 16:07:29
                #include <iostream>
                using namespace std;
                int main()
                {
                double n;
                cin >> n;
                //核心代码:
                int a = n / 8 + 0.9;
                cout << a;
                return 0;
                }
                这样简单
                
                • 0
                  @ 2023-8-7 10:25:02

                  刚刚是错的,这次就对了

                  #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
                    @ 2023-8-7 10:23:50

                    新手上路,请多关照!!

                    #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; 
                    }
                    
                    • 0
                      @ 2023-8-6 21:51:07

                      LTC LEVEL1中唯一的HT开头的题目 也是唯四贼简单的


                      #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
                        @ 2023-8-6 21:17:10
                        #include <bits/stdc++.h>
                        using namespace std;
                        
                        int main() {
                            int n;
                            cin >> n;
                            n % 8?
                            cout << n/8 + 1:
                            cout << n/8;
                            return 0;
                        }
                        
                        • 0
                          @ 2023-8-5 20:54:42

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

                          • 0
                            @ 2023-8-5 19:16:22

                            太简单了

                            int a;
                                cin >> a;
                                if (a%8==0)
                                {
                                    cout << a/8;
                                }
                                else
                                {
                                    cout << a/8+1;
                                }
                            
                            • 0
                              @ 2023-8-4 13:25:34
                              #include <iostream>
                              using namespace std;
                              int main()
                              {
                                  int n;
                                  cin >> n;
                                  if (n % 8 == 0)
                                  {
                                      cout << n / 8 << endl;
                                  }
                                  else
                                  {
                                      cout << n / 8 + 1 << endl;
                                  }
                                  return 0;
                              }
                              
                              • 0
                                @ 2023-8-2 14:52:16
                                #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
                                  @ 2023-8-1 18:50:45

                                  EASY

                                  #include <iostream>
                                  using namespace std;
                                  int main () {
                                      int n, sum = 0; //定义
                                      cin >> n; //输入
                                      for (int i = n; i > 0; i -= 8) { //循环,每次循环变量都-8
                                          sum++; //次数
                                      }
                                      cout << sum; //输出
                                      return 0; //结束
                                  }
                                  
                                  • 0
                                    @ 2023-7-18 22:16:56
                                    #include <iostream>
                                    using namespace std;
                                    int main()
                                    {
                                        long long n;//定义
                                        cin >>n;//输入
                                        long long sum=n/8;//定义
                                        if (n%8!=0)//判断是否有剩余
                                        {
                                            sum++;//如果有,那么再运一次
                                        }
                                        cout <<sum;//输出
                                        return 0;
                                    }
                                    
                                    • 0
                                      @ 2023-5-21 18:55:31
                                      #include <iostream>
                                      using namespace std;
                                      
                                      int main() {
                                          int num;
                                          cin >> num;
                                      
                                          int trips = num / 8;
                                          if (num % 8 != 0) {
                                              trips++;
                                          }
                                      
                                          cout << trips << endl;
                                      
                                          return 0;
                                      }
                                      

                                      在上述代码中,通过整除和取模运算计算出搬运的次数。将木柴的数量除以 8,得到的结果表示完整的搬运次数,然后使用判断是否有剩余的木柴需要额外搬运。如果有剩余,则搬运次数需要加 1。 记得点赞。

                                      • 0
                                        @ 2023-5-13 14:27:52
                                        #include <iostream>
                                        using namespace std;
                                        int main()
                                        {
                                            int a, b;
                                            cin >> a;
                                            b = a / 8;
                                            if (a % 8 != 0)
                                            {
                                                b += 1;
                                            }
                                            cout << b;
                                            return 0;
                                        }
                                        

                                        信息

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