1 条题解
-
0
C++ :
#include<bits/stdc++.h> using namespace std; int main(){ double n; cin>>n; cout<<fixed<<setprecision(2)<<abs(n)<<endl; return 0; }
Java :
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); double a = sc.nextDouble(); if(a > 0){ System.out.println(String.format("%.2f", a)); }else{ a = -1 * a; System.out.println(String.format("%.2f", a)); } } }
Python :
a=float(input()) b=abs(a) print("%.2f"%b)
- 1
信息
- ID
- 10213
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者