111 条题解

  • -3
    @ 2023-7-1 18:24:59

    #include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; if(n<10) { cout<<"A"; } else if(n>=10 && n<20) { cout<<"B"; } else if(n>=20 && n<40) { cout<<"C"; } else if(n>=40 && n<50) { cout<<"D"; } else if(n>=50 && n<80) { cout<<"E"; } return 0; }

    • -3
      @ 2023-4-9 9:21:20

      运用到了if语句和逻辑运算符

      /*
          A B C D E
          &&  
      */
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          int n;
          cin>>n;
          if(n<10) cout<<"A";//小于10公斤的用A型
          if(n>=10 && n<20) cout<<"B";//大于等于10公斤小于20公斤的用B型
          if( n>=20 && n<40) cout<<"C";//大于等于20公斤小于40公斤的用C型
          if(n>=40 && n<50) cout<<"D";//大于等于40公斤的小于50公斤的用D型
          if(n>=50 && n<80) cout<<"E";//大于等于50公斤小于80公斤的用E型
          return 0;
      }
      
      
      • -3
        @ 2022-8-23 19:57:06

        #include <iostream> using namespace std; int main() { int n; cin>>n; if (n<10) { cout<<"A"; } if (n>=10 and n<20) { cout<<"B"; } if (n>=20 and n<40) { cout<<"C"; } if (n>=40 and n<50) { cout<<"D"; } if (n>=50 and n<80) { cout<<"E"; } return 0; }//注释懒得写了

        • -4
          @ 2023-3-4 11:41:46

          include <bits/stdc++.h>

          include <iostream>//为了不和他人代码重复,因此导入两个库

          using namespace std ; int main() { int a; cin>>a;//以下的判断用于判断已知有A,B,C,D,E五种包装箱,为了不浪费材料,小于10公斤的用A型,大于等于10公斤小于20公斤的用B型,大于等于20公斤小于40公斤的用C型,大于等于40公斤的小于50公斤的用D型,大于等于50公斤小于80公斤的用E型.现在输入一货物的重量(小于80公斤),找出最经济型的包装箱型号. if (a < 10){ cout<<"A"; } else if(a >= 10 and a < 20){ cout<<"B"; } else if (a >= 20 and a < 40){ cout<<"C"; } else if (a >= 40 and a < 50){ cout<<"D"; } else { cout<<"E"; } }

          • -4
            @ 2022-7-8 15:39:54

            #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; }

            • -4
              @ 2022-7-3 11:02:09

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

              • -5
                @ 2022-8-19 10:21:50

                凤凰城都会变味😕

                • -6
                  @ 2022-8-5 10:45:43
                  先导入万能头文件
                  #include <bits......
                   定义并输入变量n   
                  int n;
                  cin>>n;
                  对变量n进行判断,并输出ABCDE;    
                  if ......
                      {
                          cout<<"A";
                      ......
                  }
                  

                  #include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; if (n<10) { cout<<"A"; } if (n>10 and n<20) { cout<<"B"; } if (n>=20 and n<40) { cout<<"C"; } if (n>=40 and n<50) { cout<<"D"; } if (n>=50 and n<80) { cout<<"E"; } }

                  
                  

                  • -6
                    @ 2022-7-7 20:54:04

                    条件对应了5种输出,使用if语句就行 注意⚠️如果使用的是if-else if 就需要注意最后是用else-if 结尾的,而不是else

                    • -8
                      @ 2022-5-23 15:46:54

                      题解:这道题目一共是5种条件对应了5种输出,使用if语句就行,如果使用的是if-else if 就需要注意最后是用else-if 结尾的,而不是else。

                      • -10
                        @ 2022-6-3 15:57:15

                        #include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; if(n<10) { cout<<"A"; } else if(n>=10 and n<=19) { cout<<"B"; } else if(n>=20 and n<=39) { cout<<"C"; } else if(n>=40 and n<=49) { cout<<"D"; } else if(n>=50 and n<=79) { cout<<"E"; } }

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

                        信息

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