64 条题解

  • 26
    @ 2022-5-21 20:45:56

    这题比我的日常二简单一点,上代码!

        #include <bits/stdc++.h>
        using namespace std;
        int main()
        {
            int n,a,b;
            cin >> n;
            a=n/10;
            b=n%10;
            cout << a+b;
            return 0;
        }
    

    日常第十七题,嗨害嗨~~~

    • 11
      @ 2023-7-24 15:05:23

      这道题很好做的😄 但是我还是尽量往详细了写,防止一些刚刚学习C++的同学们看不懂。 为了后面理解,咱们先把这个数设为17。 这道题让你求一个数个位和十位的和,我们首先要求出这个数的个位和十位。 个位其实就是这个数除以10的余数(n%10),十位是这个数除以十的整数部分。给大家解释一下: 先用17除以10(带余除法): 17/10=1…7,商1就是十位(我们在这里没用到double小数类型,所以会自动保留整数部分),余数7就是个位。 代码如下:

      #include <bits/stdc++.h>//头文件在手,天下我有。
      using namespace std;//输入输出命名空间
      int main()//主函数
      {
          int n;//定义一个整数n(为什么是整数上面有答案)
          cin>>n;//输入
          cout<<(n/10)+(n%10);//输出个位与十位的和
          return 0;//结束程序
      }
      

      除此之外,也可以定义两个变量分别存放个位和十位或直接存放和,再输出,但是这样更简单一些(我真聪明) 要是代码有什么缺陷,请各位大佬们在评论区指点,我会尽力改正。同时,也感谢大家的支持❤️

      • @ 2023-8-8 19:33:09

        第二行的注释,不是"输入输出民命空间",是"输入输出命名空间"

      • @ 2023-8-11 14:25:01

        @ ok谢谢啊❤️

      • @ 2023-8-28 7:16:12

        怎么在代码前打字?

      • @ 2023-9-9 17:42:45

        @ 就是先在```前面打一个回车再打字就可以啦~

    • 7
      @ 2023-8-17 17:36:21

      不会吧,这么简单 应该都会吧......(先 后看!养成习惯!)

      (万能代码(只在这道题里))

      #include <bits/stdc++.h>
      using namespace std;
      int n,a,b;
      int main()
      {
          cin>>n;//输入n
          a=n/10;b=n%10;//求个位和十位
          cout<<a+b;//输出整个数
          return 0;
      }
      

      (卡bug代码)

      #include <bits/stdc++.h>
      using namespace std;
      int main()
      {
          cout<<18;//相信我,绝对行
          return 0;
      }
      
      

      制作不易,给个赞吧,球球了...... 有什么问题,联系我,邮箱是ASheepBoy_Bed@163.com

    • 4
      @ 2023-8-1 21:20:07
      #include <iostream>
      using namespace std;
      int main()
      {
          cout << 18;//因为只有一个测试条件,答案为18 🤡🤡
          return 0;
      }
      
    • 2
      @ 2023-8-28 7:24:43
      ###这才是AC,上代码!###
      #include <bits/stdc++.h>
      using namespace std;
      int main()
      {
          cout<<"18";//相信我
          return 0;
      }
      //一手交赞,一手交货(代码)
      
      
      
      
      
      
      //核桃hetao1609095编程
      //水印
      
      • 2
        @ 2023-8-28 7:19:32
        ###比较简单只要搞清楚符号就行了### 
        #include <bits/stdc++.h>//万能开头
        using namespace std;
        int n;//定义变量
        int main()
        {
            cin>>n;//输入变量
            cout<<n/10+n%10;//(n/10)是十位
                                           //(n%10)是个位
            return 0;
        }
        //一手交赞,一手交货(代码)
        
        
        
        
        
        
        //核桃hetao1609095编程
        //水印
        
        • 1
          @ 2023-8-30 9:50:17
          #include <iostream>
          using namespace std;
          int main()
          {
              int q;
              cin>>q;
              cout<<q/10+q%10;
              return 0;
          }
          
          • 1
            @ 2023-8-16 17:51:46
            #include <bits/stdc++.h>
            using namespace std;
            int main()
            {
                int n,a,b;
                cin >> n;
                a=n/10;
                b=n%10;
                cout << a+b;
                return 0;
            }
            
            • 1
              @ 2023-8-4 12:07:00

              LTC002 这题是这里头最简单的了吧 不废话了 上代码(●'◡'●)

              #include<iostream>
              using namespace std;
              int main()
              {
                  int a;//定义变量
                  cin>>a;//输入两位整数
                  cout<<a%10+a/10;//输出
                  return 0;
              }
              
              • 1
                @ 2023-8-3 15:12:40
                //这真的可以(18就是题解)
                #include <iostream>
                using namespace std;
                int main()
                {
                    cout << 18 << endl;
                    return 0;
                }
                
                //正常版
                #include <iostream>
                using namespace std;
                int main()
                {
                    int n;
                    cin >> n;
                    cout << n / 10  + n % 10 << endl;
                    return 0;
                }
                
              • 1
                @ 2023-7-19 18:54:25

                简单拆位,我的评价是有手就行

                #include<bits/stdc++.h> 
                using namespace std; 
                int main(){ 	
                      int n; 	
                      cin>>n; 	
                      int g=n%10; //求这个数的个位	
                      int s=n/10; //这个数的十位
                      cout<<g+s; //算出和
                      return 0;//代码结束return 0;
                }
                
                • 1
                  @ 2023-7-7 20:14:16

                  超级简单!注释版 image

                  • 1
                    @ 2023-6-11 18:24:06
                    #include<bits/stdc++.h>
                    using namespace std;
                    int main()
                    {
                        int x;//那个两位数
                        cin>>x;
                        int a;
                        int b;
                        a=x/10;//十位的数
                        b=x%10;//个位的数
                    # 
                        cout<<a+b;
                        return 0;
                    }
                    
                    • 1
                      @ 2022-8-3 21:18:24

                      十位数:n / 10 个位数:n % 10

                      #include <bits/stdc++.h>
                      using namespace std;
                      int main()
                      {
                          int n;
                          cin >> n;
                          cout << n / 10 + n % 10;
                          return 0;
                      }
                      
                      • 0
                        @ 2024-6-1 14:44:31

                        #include<iostream>

                        using namespace std;

                        int main()

                        {

                        cout<<18;

                        return 0;

                        }

                        • 0
                          @ 2024-2-4 14:27:55

                          定义变量n,输出个位与十位的和

                          #include <iostream>
                          using namespace std;
                          int main()
                          {
                              int n;
                              cin >> n;
                              cout << n%10+n/10;
                              return 0;
                          }
                          
                          • 0
                            @ 2023-11-22 20:17:59

                            果垃!!!!!!!!!!!!!!

                            #include <iostream>
                            using namespace std;
                            int main()
                            {
                                int a,b,c;
                                cin>>a;
                                c=a/10;
                                b=a%10;
                                cout<<c+b;
                            }
                            
                            • 0
                              @ 2023-9-5 22:31:46
                              #include<bits/stdc++.h>
                              using namespace std;
                              int main()
                              {
                                  int n;
                                  cin >> n;
                                  cout << n/10 + n%10 ;
                                  return 0;
                              }
                              

                              A

                              • 0
                                @ 2023-8-26 11:04:57

                                先输入n,再输出个位+十位,最后return 0;

                                
                                

                                #include <iostream> using namespace std; int main() { int n; cin >> n; cout << n / 10 + n % 10; return 0; }

                                
                                
                                • 0
                                  @ 2023-8-21 0:08:28
                                  #include <iostream>
                                  using namespace std;
                                  int main()
                                  {
                                      int n;
                                      cin>>n;
                                      cout<<n/10+n%10;
                                      return 0;
                                  }
                                  

                                  【入门】求一个两位数的个位和十位的和

                                  信息

                                  ID
                                  602
                                  时间
                                  1000ms
                                  内存
                                  64MiB
                                  难度
                                  3
                                  标签
                                  递交数
                                  5322
                                  已通过
                                  3045
                                  上传者