8 条题解

  • 2
    @ 2023-6-12 20:56:52
    #include <iostream>
    #include <stdio.h>
    #include <iomanip>
    #include <math.h>
    using namespace std;
    const int N = 1e6 + 10;
    const int INF = 0x3f3f3f3f;
    int main()
    {
    	float a , b;
    	cin >> a;
    	b = fabs(a);
    	cout << fixed << setprecision(2) << b;
    	return 0;
    }
    
    • 1
      @ 2024-2-2 19:15:55

      #include <bits/stdc++.h> using namespace std; int main() { double n; cin >> n; cout <<fixed << setprecision(2)<< abs(n); return 0; }

      • 0
        @ 2025-7-8 11:26:25

        #include

        #include

        #include

        using namespace std;

        int main()

        {

        double a;
        cin >> a;
        cout << fixed << setprecision(2) << fabs(a);
        return 0;
        

        }

        • 0
          @ 2024-11-23 18:36:44
          #include <iostream>
          #include <iomanip>
          #include <cmath>
          using namespace std;
          int main()
          {
          double a;
          cin >> a;
          cout << fixed << setprecision(2) << fabs(a);
          return 0;
          }
          

          有标志认证,属三无产品,请各位放心食用

          • 0
            @ 2022-10-30 12:08:27
            #include <bits/stdc++.h>
            
            using namespace std;
            
            int main(void)
            {
                double a;
            
                cin >> a;
            
                if (a >= 0)
                {
                    cout << fixed << setprecision(2) << a;
                }
                else if (a < 0)
                {
                    cout << fixed << setprecision(2) << -a;
                }
            
                return 0;
            }
            
            • -4
              @ 2022-8-2 12:06:50
              #include<bits/stdc++.h>
              using namespace std;
              double x; 
              int main()
              {
                  cin >> x;
                  x = abs(x)/*求绝对值的函数*/; 
                  printf("%.2lf\n", x);
              }
              
              • -4
                @ 2022-2-8 19:15:29

                #include <stdio.h> #include #include <math.h> using namespace std; int main() { double a ,b ; cin >> a; b = fabs (a); printf("%.2lf",b);

                }

                • -7
                  @ 2021-12-9 22:43:34

                  abs函数:求绝对值
                  用法:

                  abs(double x);
                  

                  返回x的绝对值。 例子:

                  abs(19.5)
                  

                  返回值: 19.5

                  abs(-123.4)
                  

                  返回值: 123.4 注意:需要包括库:

                  #include <math.h>
                  
                  • 1

                  信息

                  ID
                  819
                  时间
                  1000ms
                  内存
                  128MiB
                  难度
                  5
                  标签
                  递交数
                  1054
                  已通过
                  444
                  上传者