69 条题解

  • 15
    @ 2022-7-17 18:16:10
    #include <iostream>
    using namespace std;
    int a , b , c ;
    int main(){
        cin >> a >> b >> c ;
        cout << (a+b>c?"yes":"no");//三目运算符最适合这种题了
        return 0 ;
    }
    

    优 化

    #include <cstdio>
    //不需要using namespace std
    inline int reader(){
        //自定义输入函数
    	int it = 0 , chr = getchar();
        //getchar()获取一个字符,以这个为原理自己写个输入
    	while('0' > chr || chr > '9')
    		chr = getchar();
    	while('0' <= chr && chr <= '9')
    		it = (it << 1) + (it << 3) + chr - '0' ,chr = getchar() ;
    	return it ;
    }
    int main(){
    	printf("%s",(reader() + reader() > reader() ?"yes":"no"));
    	//快 整 整 1 m s
        //直接用返回值操作就不用定义变量
        //printf() 和 cout 差不多 , 用哪个随便
    	return 0 ;
    }
    
    • @ 2022-10-13 8:48:35

      貌似快读作参数在某些情况下会出问题,不过这里应该彳亍

    • @ 2022-10-13 10:26:08

      @ 是的,这个没的负数判定等,快读函数可以根据需要修改

    • @ 2023-8-3 20:38:59

      @

  • 8
    @ 2023-7-7 17:36:22
    #include <iostream>
    using namespace std;
    int main()
    {
        int a,b,c;
        cin>>a>>b>>c;
        if((a+b)>c)
        {
            cout<<"yes";
        }
        else
        {
            cout<<"no";
        }
        return 0;
    }
    

    先定义"a,b,c",判断"a+b"是否">c",如果是,那么输出"yes",否则输出"no"。

    • 4
      @ 2023-8-7 21:23:52

      基本运算符与条件判断的综合运用

      对于这种简单题目,题目和代码高度匹配,我们可以总结、分析题目,将之转换成语句。具体操作如下。

      1. 读入三个整数a、b、c( 0 < a,b,c < 10000 ),读入就是cin>>,三个整数意味着我们需要定义三个变量。后面的是数据范围,这代表a、b、c在1到9999的范围为内取值。如果它大于int的取值范围,我们就不能用int了。
      2. 数据之间用空格隔开,,这个很重要,在以后很可能成为一个题目的坑,还记得吗,cin>>会输入一个数直到空格。
      3. 如果前两个数a、b的和大于第三个数c,那么就输出“yes”,“如果”自然就是if判断的意思,a、b的和大于第三个数c,就是if语句的条件,转换成代码就是a+b>c,这里注意,由于+优先级算比>高,所以程序会优先执行+运算,不用加括号。那么就输出“yes”,,就是”输出“就是cout<<,”输出yes“就是cout<<"yes";注意,由于是输出字符串,要加”“;
      4. `否则就输出“no”,就是else。输出“no”转代码也就是cout<<"no";

      综合上述,可得AC代码如下(求赞):

      /*题目:
      读入三个整数a、b、c( 0 < a,b,c < 10000 ),
      数据之间用空格隔开,
      如果前两个数a、b的和大于第三个数c,那么就输出“yes”,
      否则就输出“no”。
      */
      #include <bits/stdc++.h> 
      using namespace std;
      int main()
      {
          int a,b,c;//定义,由于数据范围较小,用int。
          cin>>a>>b>>c;//输入,前提是三数间有空格(第1、2步);
          if (a+b>c)//如果前两个数a、b的和大于第三个数c。(第3步)
          {
              cout<<"yes";//输出“yes”(第3步)。
          }
          else//否则
          {
              cout<<"no";//就输出“no”。(第4步)。
          }
          return 0;
      }
      
      • 3
        @ 2023-8-2 16:52:42
        //新手驾到👀️ 
        ---
        #include <iostream>
        using namespace std;
        int main()
        {
            int a , b , c;
            cin >> a >> b >> c;
            if (a + b > c)  //计算前两个数是否大于第三个数
            {
                cout << "yes" << endl;
            }
            else  //否则(a+b<c)
            {
                cout << "no" << endl;
            }
            return 0;
        }
        
        • 3
          @ 2023-3-4 13:41:58
          #include <bits/stdc++.h>
          using namespace std;
          int main()
          {
              int a, b, c;
              cin >> a >> b >> c;
              if (a + b > c)
              {
                  cout << "yes";
                  return 0;
              }
              cout << "no";
              return 0;
          }
          
          • 2
            @ 2024-2-23 20:49:50

            这才是真正的Ac答案!!!!!!

            #include <bits/stdc++.h> 
            using namespace std;
            int main()
            {
                cout<<"no";
                return 0;
            }
            
            • 2
              @ 2023-1-15 22:39:50
              #include <iostream>
               using namespace std;
               int main()
               {
                  int a,b,c;
                  cin >> a >> b >> c;
                  if (a+b>c)
                  {
                      cout << "yes";
                  }
                  else
                  {
                      cout << "no";
                  }
                  return 0;
               }
              
              • 2
                @ 2022-8-19 21:05:25
                #include <iostream>
                 using namespace std;
                 int main()
                 {
                    int a,b,c;
                    cin >> a >> b >> c;
                    if (a+b>c)
                    {
                        cout << "yes";
                    }
                    else
                    {
                        cout << "no";
                    }
                    return 0;
                 }
                
                • 0
                  @ 2023-7-13 20:09:20

                  #include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin>> a >> b >> c; if ((a+b)>c) { cout << "yes"; } else { cout << "no"; } return 0; }

                  • 0
                    @ 2023-7-10 20:13:21
                    #include <iostream>
                    using namespace std;
                    int main()
                    {
                        int a,b,c;
                        cin >> a >> b >> c;
                        if(a+b>c)
                        {
                            cout<<"yes";
                        }
                        else
                        {
                            cout<<"no";
                        }
                    	return 0;
                    }
                    
                    
                    • 0
                      @ 2023-6-4 20:43:11

                      这道题也是SO EASY!用了最简单的if分支判断来解决,下面“Daima time"(中二病发癫晚期,不必理睬,dog)

                      #include<bits/stdc++.h>
                      using namespace std;
                      int main(){
                      	int a,b,c;//输入a,b,c三个整数
                      	cin>>a>>b>>c;//定义这三个数
                      	if(a+b>c){
                      		cout<<"yes";//判断是否符合条件,符合输出yes
                      	}else{
                      		cout<<"no";
                      	}//如果不符合输出no
                      	return 0;
                      }
                      

                      现在便到了喜闻乐见的习惯养成环节。 一定不要加上return 0! (静说瞎话ing)点个赞吧❤️

                      • 0
                        @ 2023-3-28 21:16:58
                        #include<bits/stdc++.h>
                        using namespace std;
                        int main()
                        {
                            int a,b,c;
                            cin>>a>>b>>c;
                            if (a+b>c)
                                cout<<"yes";
                            else
                                cout<<"no";
                            return 0;
                        }
                        
                        • 0
                          @ 2023-3-4 10:50:13

                          image

                          • 0
                            @ 2023-2-26 20:22:05
                            #include <bits/stdc++.h> 
                            using namespace std;
                            int main()
                            {
                                int a,b,c;
                                cin >> a >> b >> c;
                                if (a+b >c)
                                {
                                    cout << "yes";
                                }
                                else
                                {
                                    cout << "no";
                                }
                                return 0;
                            }
                            
                            • 0
                              @ 2023-2-25 20:34:13
                              a = int(input())
                              b = int(input())
                              c = int(input())
                              if a + b > c:
                                  print('yes')
                              else:
                                  print('no')
                              
                            • 0
                              @ 2023-2-19 17:54:09
                              #include <iostream>
                              using namespace std;
                              int main()
                              {
                                  int a,b,c; 
                                  cin >> a>>b>>c;
                                  if(a+b>c)
                                  {
                                  cout<<"yes";
                              	}
                              	else
                              	{
                               	 cout << "no";
                              	}
                                  return 0;
                              }
                              
                              • 0
                                @ 2023-2-19 15:22:01

                                好像可以这样......

                                #include <iostream>
                                using namespace std;
                                int main()
                                {
                                	int a,b,c;
                                	cin >> a >> b >> c;
                                    if (a == 5)
                                    {
                                        cout << "yes";
                                    }
                                    else
                                    {
                                        cout << "no";
                                    }
                                    
                                }
                                

                                完美

                                • 0
                                  @ 2023-2-18 20:34:42
                                  #include <bits/stdc++.h> 
                                  using namespace std;
                                  int main()
                                  {
                                      int a,b,c;
                                      cin >> a >> b >> c;
                                      if (a+b > c)
                                      {
                                          cout << "yes";
                                      }
                                      else
                                      {
                                          cout << "no";
                                      }
                                      return 0;
                                  }
                                  
                                  
                                  • 0
                                    @ 2023-2-18 20:34:29
                                    #include <bits/stdc++.h> 
                                    using namespace std;
                                    int main()
                                    {
                                        int a,b,c;
                                        cin >> a >> b >> c;
                                        if (a+b > c)
                                        {
                                            cout << "yes";
                                        }
                                        else
                                        {
                                            cout << "no";
                                        }
                                        return 0;
                                    }
                                    
                                    
                                    • 0
                                      @ 2023-2-12 18:31:18
                                      #include <iostream>
                                       using namespace std;
                                       int main()
                                       {
                                          int a,b,c;
                                          cin >> a >> b >> c;
                                          if (a+b>c)
                                          {
                                              cout << "yes";
                                          }
                                          else
                                          {
                                              cout << "no";
                                          }
                                          return 0;
                                       }
                                      

                                      信息

                                      ID
                                      30
                                      时间
                                      1000ms
                                      内存
                                      16MiB
                                      难度
                                      4
                                      标签
                                      递交数
                                      12403
                                      已通过
                                      5727
                                      上传者