Skip to content

Commit b9a4ee1

Browse files
author
lanyuanxiaoyao
committed
修改文件: _posts/2014-09-18-absulote.md
1 parent b1da1c1 commit b9a4ee1

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

_posts/2014-09-18-absulote.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
layout: post
3+
title: 2003.求绝对值
4+
date: 2014-09-18 14:04
5+
categories: 杭电HDU
6+
tags: [杭电HDU]
7+
---
8+
## Problem
9+
>**Problem Description**
10+
求实数的绝对值。
11+
**Input**
12+
输入数据有多组,每组占一行,每行包含一个实数。
13+
**Output**
14+
对于每组输入数据,输出它的绝对值,要求每组数据输出一行,结果保留两位小数。
15+
**Sample Input**
16+
123
17+
-234.00
18+
**Sample Output**
19+
123.00
20+
234.00
21+
22+
## Solution
23+
```cpp
24+
#include<stdio.h>
25+
#include<math.h>
26+
int main()
27+
{
28+
double num;
29+
while(scanf("%lf",&num)!=EOF){
30+
num=fabs(num);
31+
printf("%.2lf\n",num);
32+
}
33+
return 0;
34+
}
35+
```

0 commit comments

Comments
 (0)