28 条题解

  • 0
    @ 2024-5-26 19:21:39

    这道题所有巨佬都忽视了一个问题,一个循环解决不香吗???直接上代码好吧

    cin >> x;
    if (maxx < x) maxx = x;
    if (minn > x) minn = x;
    

    这就是我的核心代码,具体代码参考奎若大佬方法一代码!

    • 0
      @ 2024-2-5 15:01:36

      rth rwhhhhhhhhhhhhhhhhhhh

      • -3
        @ 2022-7-16 11:58:29
        #include <stdio.h>//调用scanf() printf()
        #include <algorithm>//调用sort()
        using namespace std;
        int a[3];//三个礼物,只需要a[3]即可,数组从a[0]开始
        int main(){
        	for(int i = 0 ; i < 3 ; i ++)
        		scanf("%i", &a[i]);//输入
        	sort(a,a+3);//排序,找最大最小
        	printf("%i\n%.1f",a[0] + a[2],(a[0]+a[2])/2.0);
            //"%i"为格式化整型 "\n"为换行符 "%.if"为输出一位小数
            //除以2.0是强制转换int为实数类型
        	return 0 ;
        }
        
        • @ 2023-7-22 13:10:33

          我记得C++标准头文件除万能头以外不许有后缀.h了,用cstdio好一点吧

      • -3
        @ 2022-5-26 19:00:23

        三个数中找出两个数(最大数和最小数)

        比如这三个数是x,y,z,会有xy,xz,yz三种结果,这两个数分别是最大数和最小数,至于谁大谁小,我们每种组合里面又会分为两种情况,比如xy,可以是x最大,y最小;也可以是y最大,x最小

          if(x>y && y>z || z>y && y>x)//xz
          {
          	cout<<x+z<<endl<<fixed<<setprecision(1)<<(x+z)/2;
          }
          if(x>z && z>y || y>z && z>x)//xy
          {
          	cout<<x+y<<endl<<fixed<<setprecision(1)<<(x+y)/2;
          }
           if(y>x && x>z || z>x && x>y )//zy
          {
          	cout<<y+z<<endl<<fixed<<setprecision(1)<<(z+y)/2;
          }
        
        • -4
          @ 2024-2-5 14:59:33

          cc

          • -5
            @ 2024-2-5 15:02:15
            tr                                                                          r                                                               rt             rt
            
          • -6
            @ 2024-2-5 14:59:38

            cc

            • -18
              @ 2023-3-17 14:05:08

              jjj**jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj

              uuuyyyyyyyoioiioioioioioioioiioiooiii**

              信息

              ID
              716
              时间
              1000ms
              内存
              128MiB
              难度
              5
              标签
              递交数
              3473
              已通过
              1358
              上传者