111 条题解

  • 0
    @ 2023-7-30 13:35:25
    #include<iostream>
    using namespace std;
    int main() //导入
    {
        int a; //定义变量
        cin >> a; //输入
        if (a < 10)
        {
            cout << "A";
        }
        if (a >= 10 and a < 20)
        {
            cout << "B";
        }
        if (a >= 20 and a < 40)
        {
            cout << "C";
        }
        if (a >= 40 and a < 50)
        {
            cout << "D";
        }
        if (a >= 50 and a < 80)
        {
            cout << "E"; //进行逐一判断
        }
        return 0; //结束
    }
    
    • 0
      @ 2023-7-24 14:42:09
      #include <bits/stdc++.h> 
      using namespace std;
      int main()
      {
          int a;
          cin >> a;
          if (a < 10)
          {
              cout << "A";
          }
          if (a < 20 and a >= 10)
          {
              cout << "B";
          }
          if (a < 40 and a >= 20)
          {
              cout << "C";
          }
          if (a < 50 and a >= 40 )
          {
              cout << "D";
          }
          if (a < 80 and a >= 50)
          {
              cout << "E";
              return 0;
          }
      
      • 0
        @ 2023-7-18 21:25:57
        #include <iostream>
        using namespace std;
        int main()
        {
        	int n;
        	cin >> n;
            if(n<10)
            {
            cout<<"A"<<endl;
            }
            if(n>=10 && n<20)
            {
            cout<<"B"<<endl;
        	}
        	if(n>=20 && n<40)
        	{
         	 cout << "C"<<endl;
        	}
            if(n>=40 && n<50)
            {
            cout<<"D"<<endl;
        	}
        	if(n>=50)
        	{
         	 cout << "E"<<endl;
        	}
        	return 0;
        }
        
        • 0
          @ 2023-7-7 20:02:12

          超级简单! image

          • 0
            @ 2023-6-26 14:16:01
            #include <iostream>
            using namespace std;
            int main()
            {
            	int x;
                cin>>x;
                if(x < 10)
                {
                    cout << "A";
                }
                else
                {
                    if(x < 20)
                    {
                        cout << "B";
                    }
                    else
                    {
                        if (x < 40)
                        {
                            cout << "C";
                        }
                        else
                        {
                            if(x < 50)
                            {
                                cout << "D";
                            }
                            else
                            {
                                if (x < 80)
                                {
                                    cout << "E";
                                }
                            }
                        }
                    }
                }
                return 0;
            }
            
            • 0
              @ 2023-6-5 20:27:05

              这道题也是最基础的if分支判断问题,用到了ifelse if接下来:"Daima time"

              #include<bits/stdc++.h>
              using namespace std;
              int main(){
                  int n;//定义一个量n
                  cin>>n;//给n赋值
                  if(n<10){
                  	cout<<"A";//判断是否大于10
              	}else if(n>=10 && n<20){
              	    cout<<"B";//判断是否大于等于10,并且小于20
              	}else if(n>=20 && n<40){
              		cout<<"C";//判断是否大于等于20,并且小于40
              	}else if(n>=40 && n<50){
              		cout<<"D";//判断是否大于等于40,并且小于50
              	}else if(n>=50 && n<=80){
              		cout<<"E";//判断是否大于等于50,并且小于等于80
              	}
              	return 0;
              }
              

              在这则代码中,用到了&&表示与,同时满足。也可以用and来连接 接下来就是句尾一定要加上return 0!!!(点个赞吧❤️ ,555没人给我点赞)

              • 0
                @ 2023-2-25 20:47:14

                用Python会更好更简便: a = int(input()) if a < 10: print('A') elif a < 20 print('B') elif a < 40: print('C') elif a < 50: print('D') else: print('E')

                • @ 2023-8-13 15:28:31

                  我想在C++题目中交Python代码(doge

                • @ 2024-1-28 20:40:49

                  总算遇到一个用Python的了

              • 0
                @ 2023-2-19 20:21:27

                呵呵,and 也可以写作 && ,上代码!

                #include <iostream>
                using namespace std;
                int main()
                {
                int a;
                cin >> a;
                if (a < 10)
                {
                cout << "A";
                }
                if (a < 20 && a >= 10)
                {
                cout << "B";
                }
                if (a < 40 && a >= 20)
                {
                cout << "C";
                }
                if (a < 50 && a >= 40)
                {
                cout << "D";
                }
                if (a < 80 && a >= 50)
                {
                cout << "E";
                }
                return 0;
                }
                

                下一题:[](https://题目详情 - 【入门】求绝对值 - 核OJ_核桃编程 (hetao101.com))

                • 0
                  @ 2023-2-18 19:46:50

                  #include <iostream> using namespace std; int main() { int a; cin >> a; if (a<10) { cout << "A"; } if (a<20 and a>=10 { cout << "B"; } if (a<40 and a>=20) { cout << "C"; } if (a<50 and a>=40) { cout << "D"; } if (a<80 and a>=50) { cout << "E"; } return 0; }

                  • 0
                    @ 2023-2-12 16:31:45

                    #include <iostream> using namespace std; int main() { int a; cin >> a; if (a<10) { cout << "A"; } if (a<20 and a>=10) { cout << "B"; } if (a<40 and a>=20) { cout << "C"; } if (a<50 and a>=40) { cout << "D"; } if (a<80 and a>=50) { cout << "E"; } return 0; }

                    • 0
                      @ 2023-2-12 13:33:28
                      #include<iostream>
                      using namespace std;
                      int main()
                      {
                          int a;
                          cin >> a;
                          if (a<10)
                          {
                              cout << "A";       
                          }
                          if (a<20 and a>=10)
                          {
                              cout << "B";
                          }
                          if (a<40 and a>=20)
                          {
                              cout << "C";
                          }
                          if (a<50 and a>=40)
                          {
                              cout << "D";
                          }
                          if (a<80 and a>=50)
                          {
                              cout << "E";
                          }
                          return 0;
                      }
                      
                      • 0
                        @ 2023-2-12 13:20:25
                        上代码!  
                        
                        //此题过于简单,在看的你太傻傻傻傻傻
                        
                        #include <iostream>
                            using namespace std;
                            int main()
                            {
                                int a;
                                cin >> a;
                                if (a<10)
                                {
                                    cout << "A";
                                }
                                if (a<20 && a>=10)
                                {
                                    cout << "B";
                                }
                                if (a<40 && a>=20)
                                {
                                    cout << "C";       
                                }
                                if (a<50 && a>=40)
                                {
                                    cout << "D";
                                }
                                if (a<80 && a>=50)
                                {
                                    cout << "E";
                                }
                                return 0;
                            }
                        
                        • 0
                          @ 2023-2-12 11:42:05
                          #include <iostream>
                              using namespace std;
                              int main()
                              {
                                  int a;
                                  cin >> a;
                                  if (a<10)
                                  {
                                      cout << "A";
                                  }
                                  else if (a<20)
                                  {
                                      cout << "B";
                                  }
                                  else if (a<40)
                                  {
                                      cout << "C";       
                                  }
                                  else if (a<50)
                                  {
                                      cout << "D";
                                  }
                                  else if (a<80)
                                  {
                                      cout << "E";
                                  }
                                  return 0;
                              }
                          
                          
                          • 0
                            @ 2023-2-6 15:34:35

                            写题解请注意

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

                            题解一定要有思路解析或代码注释,能否让别人理解你的思路

                            也是你的能力的检验,不要只放无意义的代码给大家复制,那就失去了做题的初心。

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

                            ```cpp

                            你的代码

                            ```

                            </span>

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

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

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

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

                            题解被删除的可能

                            1. 代码不符合格式规范
                            2. 没有思路讲解或者没有注释,
                            3. 无意义的题解

                            大家携手共同维护一个良好的编程环境,如果一经发现,多次作乱。可能会被管理员拉黑,请注意,一旦拉黑即失去登陆资格。

                            • 0
                              @ 2023-2-3 17:11:55

                              老子二话不说,上代码!

                              #include <iostream>
                                  using namespace std;
                                  int main()
                                  {
                                      int a;
                                      cin >> a;
                                      if (a<10)
                                      {
                                          cout << "A";
                                      }
                                      if (a<20 and a>=10)
                                      {
                                          cout << "B";
                                      }
                                      if (a<40 and a>=20)
                                      {
                                          cout << "C";       
                                      }
                                      if (a<50 and a>=40)
                                      {
                                          cout << "D";
                                      }
                                      if (a<80 and a>=50)
                                      {
                                          cout << "E";
                                      }
                                      return 0;
                                  }
                              
                              
                              • 0
                                @ 2023-1-15 22:45:32
                                #include <iostream>
                                    using namespace std;
                                    int main()
                                    {
                                        int a;
                                        cin >> a;
                                        if (a<10)
                                        {
                                            cout << "A";
                                        }
                                        if (a<20 and a>=10
                                        {
                                            cout << "B";
                                        }
                                        if (a<40 and a>=20)
                                        {
                                            cout << "C";       
                                        }
                                        if (a<50 and a>=40)
                                        {
                                            cout << "D";
                                        }
                                        if (a<80 and a>=50)
                                        {
                                            cout << "E";
                                        }
                                        return 0;
                                    }
                                
                                • 0
                                  @ 2023-1-9 14:09:44

                                  #include<iostream> using namespace std;

                                  int main(){ int n;//这串代码要用到多个判断语句 cin >> n; if (n < 10){ cout << "A"; } if (n >= 10 && n < 20){ cout << "B"; } if (n >= 20 && n < 40){ cout << "C"; } if (n >= 40 && n < 50){ cout << "D"; } if (n >= 50 && n < 80){ cout << "E"; } return 0; }

                                  • 0
                                    @ 2022-11-19 15:14:27
                                    #include <iostream>
                                        using namespace std;
                                        int main()
                                        {
                                            int a;
                                            cin >> a;
                                            if (a<10)
                                            {
                                                cout << "A";
                                            }
                                            if (a<20 and a>=10
                                            {
                                                cout << "B";
                                            }
                                            if (a<40 and a>=20)
                                            {
                                                cout << "C";       
                                            }
                                            if (a<50 and a>=40)
                                            {
                                                cout << "D";
                                            }
                                            if (a<80 and a>=50)
                                            {
                                                cout << "E";
                                            }
                                            return 0;
                                        }
                                    
                                    • 0
                                      @ 2022-10-31 13:15:36

                                      #include <iostream> using namespace std; int main() { int a; cin >> a; if (a < 10) { cout << "A"; } else { if (a < 20) { cout << "B"; } else { if (a < 40) { cout << "C"; } else { if (a < 50) { cout << "D"; } else { if (a < 80) { cout << "E"; } } } } } return 0; }

                                      • 0
                                        @ 2022-10-31 13:14:13

                                        #include <iostream> using namespace std; int main() { int a; cin >> a; if (a < 10) { cout << "A"; } else { if (a < 20) { cout << "B"; } else { if (a < 40) { cout << "C"; } else { if (a < 50) { cout << "D"; } else { if (a < 80) { cout << "E"; } } } } } return 0; }

                                        【入门】找出最经济型的包装箱型号

                                        信息

                                        ID
                                        39
                                        时间
                                        1000ms
                                        内存
                                        16MiB
                                        难度
                                        5
                                        标签
                                        递交数
                                        11548
                                        已通过
                                        4839
                                        上传者