codevs 1206 保留两位小数

http://codevs.cn/problem/1206/

1206 保留两位小数

 

 时间限制: 1 s
 空间限制: 128000 KB
 题目等级 : 青铜 Bronze
 查看运行结果
 
 
题目描述  Description

保留两位小数输出一个浮点数。

输入描述  Input Description

一个浮点数。double范围内

输出描述  Output Description

保留两位小数输出

样例输入  Sample Input

11

样例输出  Sample Output

11.00

数据范围及提示  Data Size & Hint
C++用 printf("%.2lf",a);
Pascal用 writeln(a:0:2);
 
      
C++和Pascal用户都请使用double类型,不要使用float,real,extended类型。


分析:


水题。


AC代码:

 1 /*
 2 作者:1348066599@qq.com
 3 题目:p1206 保留两位小数
 4 */
 5 
 6 #include <stdio.h>
 7 #include <algorithm>
 8 #include <iostream>
 9 #include <string.h>
10 #include <string>
11 #include <math.h>
12 #include <stdlib.h>
13 #include <queue>
14 #include <stack>
15 #include <set>
16 #include <map>
17 #include <list>
18 #include <iomanip>
19 #include <vector>
20 #pragma comment(linker, "/STACK:1024000000,1024000000")
21 #pragma warning(disable:4786)
22 
23 using namespace std;
24 
25 const int INF = 0x3f3f3f3f;
26 const int MAX = 10000 + 10;
27 const double eps = 1e-8;
28 const double PI = acos(-1.0);
29 
30 int main()
31 {
32     double a;
33     while(~scanf("%lf", &a))
34     {
35         printf("%.2lf\n",a);
36     }
37     return 0;
38 }
View Code

 

转载于:https://www.cnblogs.com/jeff-wgc/p/4454151.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值