16 条题解

  • 4
    @ 2023-1-26 16:27:12
    #include <bits/stdc++.h>
    using namespace std;
    int main(){
        int a,b,c;
        cin>>a>>b>>c;
        cout<<max(a,max(b,c));
        return 0;
    }
    
    • 2
      @ 2022-7-2 21:05:16
      /*****************************************
      备注:
      ******************************************/
      #include <math.h>
      #include <stdio.h>
      #include <iostream>
      using namespace std;
      int main()
      {
      	int a,b,c;
      	cin >> a >> b >> c;
      	//1
      	a = max(a,b);
      	a = max(a,c);
      	cout << a << endl;
      	//2
      	a = max(a, max(b,c));
      	cout << a << endl;
      
      	//3
      	if(a >= b )
      	{
      		if(a >= c)
      		{
      			cout << a << endl;
      		}
      		else
      		{
      			cout << c << endl;
      		}
      	}
      	else 
      	{
      		if(b >= c)
      		{
      			cout << b << endl;
      		}
      		else 
      		{
      			cout << c << endl;
      		}
      	}
      
      	//4
      	if(a >= b && a >= c)
      	{
      		cout << a << endl;
      	}
      	else if(b >= a && b >= c)
      	{
      		cout << b << endl;
      	}
      	else
      	{
      		cout << c << endl;
      	}
      }
      
      • 1
        @ 2025-11-7 21:31:32

        包AC

        #include<bits/stdc++.h>
        using namespace std;
        int a,b,c; 
        int main(){
        	cin >> a >> b >> c;
        	cout << max(c,max(a,b));
        	return 0;
        }
        
        • 1
          @ 2025-9-14 16:26:32

          高手才会

          #include <iostream>
          using namespace std;
          int main()
          {
              int a,b,c;
              cin >> a >> b >> c;
              cout << max(max(a,b),c);
              
              return 0;
          }
          
          • 1
            @ 2022-8-12 22:03:50
            #include <stdio.h>
            #include <iostream>
            #include <math.h>
            #include <iomanip>
            using namespace std;
            int main()
            {
            	int a,b,c;
            	cin >>a >>b >>c;
            	a=max (a,b);
            	a=max (a,c);
            	cout <<a;
            }
            
            • 1
              @ 2022-7-2 12:04:16
              /*****************************************
              备注:
              ******************************************/
              #include <math.h>
              #include <stdio.h>
              #include <iostream>
              using namespace std;
              int main()
              {
              	int a,b,c;
              	cin >> a >> b >> c;
              	// a = max(a,b);
              	// a = max(a,c);
              	// a = max(a, max(b,c));
              	// cout << a << endl;
              
              
              	// if(a > b)
              	// {
              	// 	if(a > c)
              	// 	{
              	// 		cout << a;
              	// 	}
              	// 	else if(c > a)
              	// 	{
              	// 		cout << c << endl;
              	// 	}
              	// }
              	// else if(a <= b)
              	// {
              	// 	if(b >= c)
              	// 	{
              	// 		cout << b << endl;
              	// 	}
              	// 	else 
              	// 	{
              	// 		cout << c << endl;
              	// 	}
              	// }
              	// 
              	if(a >= b && a >= c)
              	{
              		cout << a;
              	}
              	else if(b >= a && b >= c) 
              	{
              		cout << b;
              	}
              	else if(c >= a && c >= b) // 只写else 也可以
              	{ 
              		cout << c << endl;
              	}
              }
              
              • 1
                @ 2021-12-4 12:32:42

                max函数:返回两个数中较大的一个数
                包括库:

                #include <cmath>
                

                语法:

                max(double x, double y);
                

                作用: 返回x, y 中的最大值
                本题思路: 输入三个数a,b,c ,对a和b取最大值后再与c取最大值,即

                max(max(a,b),c);
                

                即可。

                • 0
                  @ 2024-4-12 21:39:08
                  #include <bits/stdc++.h>
                  #include <stdio.h>
                  #include <iostream>
                  #include <math.h>
                  #include <iomanip>
                  using namespace std;
                  int main(){
                      int a,b,c;
                      cin>>a>>b>>c;
                      cout<<max(a,max(b,c));
                      return 0;
                  }
                  
                  
                • 0
                  @ 2023-7-10 22:05:11
                  #include <iostream>
                  using namespace std;
                  int main()
                  {
                    int a,b,c;
                      cin>>a>>b>>c;
                      a=a>b?a:b;
                      a=a>c?a:c;
                      cout<<a<<endl;
                    return 0;
                  }
                  
                  
                  • 0
                    @ 2023-4-9 20:17:28

                    一定要注意max(a,b)中ab必须是同类型的,如int。必须一样,long和int也不行,试过了。 代码如下:

                    #include <iostream>
                    #include <cmath>
                    using namespace std;
                    int main()
                    {
                    	int maxi;
                    	int a,b,c;
                    	cin>>a>>b>>c; 
                    	maxi=-2100000000;
                    	a=max(maxi,a);
                    	b=max(b,a);
                    	c=max(c,b);
                    	cout<<c;
                    	return 0;
                    }
                    
                    • -1
                      @ 2024-5-29 19:50:26

                      #include using namespace std; int main() { int a,b,c; cin >>a>>b>>c; if (a>=b&&a>=c){cout<<a;} else if (b>=a&&b>=c){cout<<b;} else if (c>=b&&c>=a){cout<<c;} return 0; }

                      • -1
                        @ 2024-5-22 20:36:24

                        #include using namespace std; int main() { char x; cin>>x; if(65<=x and x<=90) { x = x + 32; cout<<x; }else if(97<=x and x<=122) { x=x-32; cout<<x; }else { cout<<x; } return 0; }

                        • -1
                          @ 2024-4-12 21:39:05
                          #include <bits/stdc++.h>
                          #include <stdio.h>
                          #include <iostream>
                          #include <math.h>
                          #include <iomanip>
                          using namespace std;
                          int main(){
                              int a,b,c;
                              cin>>a>>b>>c;
                              cout<<max(a,max(b,c));
                              return 0;
                          }
                          
                          
                          • -1
                            @ 2024-4-12 21:39:00
                            #include <bits/stdc++.h>
                            #include <stdio.h>
                            #include <iostream>
                            #include <math.h>
                            #include <iomanip>
                            using namespace std;
                            int main(){
                                int a,b,c;
                                cin>>a>>b>>c;
                                cout<<max(a,max(b,c));
                                return 0;
                            }
                            
                            
                            • -1
                              @ 2024-4-6 12:42:47

                              `#include #include #include #include #include #include const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; using namespace std; int a,b,c; void f(int a,int b,int c) { cout<<max(a,max(b,c)); } int main(){ cin>>a>>b>>c; f(a,b,c); return 0; } ````

                              • -2
                                @ 2022-1-2 15:19:37
                                #include <stdio.h>
                                #include <iostream>
                                #include <math.h>
                                #include <iomanip>
                                using namespace std;
                                int main()
                                {
                                	int a,b,c;
                                	cin >>a >>b >>c;
                                	a=max (a,b);
                                	a=max (a,c);
                                	cout <<a;
                                }
                                
                                • 1

                                信息

                                ID
                                877
                                时间
                                1000ms
                                内存
                                128MiB
                                难度
                                5
                                标签
                                递交数
                                1146
                                已通过
                                469
                                上传者