codevs 1206 保留两位小数
http://codevs.cn/problem/1206/
保留两位小数输出一个浮点数。
一个浮点数。double范围内
保留两位小数输出
11
11.00
C++用 printf("%.2lf",a);
Pascal用 writeln(a:0:2);
C++和Pascal用户都请使用double类型,不要使用float,real,extended类型。 分析: 水题。 AC代码:
/*
作者:1348066599@qq.com
题目:p1206 保留两位小数
*/ #include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <iomanip>
#include <vector>
#pragma comment(linker, "/STACK:1024000000,1024000000")
#pragma warning(disable:4786) using namespace std; const int INF = 0x3f3f3f3f;
const int MAX = + ;
const double eps = 1e-;
const double PI = acos(-1.0); int main()
{
double a;
while(~scanf("%lf", &a))
{
printf("%.2lf\n",a);
}
return ;
}
codevs 1206 保留两位小数的更多相关文章
- wikioi 1206 保留两位小数 【考查浮点数输入输出】
/*======================================================================== 1206 保留两位小数 题目描述 Descript ...
- java使double保留两位小数的多方法 java保留两位小数
这篇文章主要介绍了java使double类型保留两位小数的方法,大家参考使用吧 复制代码 代码如下: mport java.text.DecimalFormat; DecimalFormat d ...
- js保留两位小数
js保留两位小数四舍五入: (Math.floor(until_price*100)/100).toFixed(2);//会四舍五入 保留两位小数 且不四舍五入(三种方式,请用最后一种): var ...
- JS限制input输入的为数字并且有小数的时候最多保留两位小数
JS限制input用户输入的为数字并且有小数的时候最多保留两位小数,代码如下: html部分: <input type="number" onkeypress="r ...
- 字符串怎么换行 || 字符串中使用单引号时应该怎么写 || 保留两位小数 || 数字0在if中的意思是false || 什么情况下会会报undefined || null和undefined的区别 ||
换行的字符串 "This string\nhas two lines" 字符串中使用单引号时应该怎么写 'You\'re right, it can\'t be a quote' ...
- Double 数据保留两位小数一:五舍六入
package com; public class T2 { public static void main(String[] args) { System.out.println(calculate ...
- Double 数据保留两位小数二:直接截取小数后面两位,不进行四舍五入
package com; public class T2 { public static void main(String[] args) { System.out.println(calculate ...
- java保留两位小数
java保留两位小数问题: 方式一: 四舍五入 double f = 111231.5585; BigDecimal b = new BigDecimal(f); d ...
- Java保留两位小数的几种做法
1. String类型数字始终保留两位小数 , RoundingMode.HALF_UP); return bd.toString(); } /** * 使用DecimalFormat,保留小数点后 ...
随机推荐
- 局部变量、结构体和main函数
在函数中定义的变量称为自动局部变量.因为每次调用该函数时,它们都自动“创建”,并且它们的只对于函数来说是局部的,局部对象的变量都会默认为空.局部变量的值只能在定义该变量的函数中访问,不能从函数之外访问 ...
- 关于hive的存储格式
1.存储格式 textfile rcfile orc parquet 2.存储方式 按行存储 ->textfile 按列存储 ->parquet 3.压缩比 4.存储textfile的原文 ...
- This system is not registered with RHN
在红帽EL5上运行yum,提示“This system is not registered with RHN”,意思是没有在官网上注册,不能下载RH的软件包,替代方案是采用centos源. 1.卸载r ...
- Difference between _, __ and __xx__ in Python
When learning Python many people don't really understand why so much underlines in the beginning of ...
- [LeetCode] Maximal Rectangle(good)
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and ...
- ArcGIS API for Silverlight 调用GP服务绘制等值面
原文:ArcGIS API for Silverlight 调用GP服务绘制等值面 GP服务模型如下图: 示例效果图片如下:
- Ubuntu 12.04+DarwinStreamingSrvr6.0.3 架设流媒体服务器
1.安装Ubuntu 12.04操作系统,网上很多教程.. 2.打开终端,下载darwin源代码DarwinStreamingSrvr6.0.3-Source.tar,补丁patch dss-6.0. ...
- Android笔记-获取图片
1. 图片放在sdcard中,根据路径获得: Bitmap imageBitmap = BitmapFactory.decodeFile(path) (path 是图片的路径,跟目录是/sdcard ...
- Java学习-026-类名或方法名应用之二 -- 统计分析基础
前文讲述了类名或方法的应用之一调试源码,具体请参阅:Java学习-025-类名或方法名应用之一 -- 调试源码 此文主要讲述类名或方法应用之二统计分析,通过在各个方法中插桩(调用桩方法),获取方法的调 ...
- Java学习-011-创建文件实例及源代码
此文源码主要为应用 Java 创建文件的源代码.若有不足之处,敬请大神指正,不胜感激! 创建文件的源代码如下所示: /** * @function 文件操作:创建文件.若文件不存在,则直接创建文件:若 ...