HDU 4493 Tutor(精度处理)
#include<stdio.h>
int main()
{
int t;
double a,s;
scanf("%d",&t);
while(t--)
{
s=;
for(int i=;i<;i++)
{
scanf("%lf",&a);
s+=a;
}
//1.注意案例的输出格式
//2.rounded to the nearest penny int ss=s/12.0+0.005;
printf("$%d",ss);
int yi,er,shu;
shu=(s/12.0+0.005)*;
yi=shu%/;er=shu%;
if(yi!=||er!=)
{
printf(".");
if(yi!=&&er==)
printf("%d",yi);
else
printf("%d%d",yi,er);
}
puts("");
}
return ;
}
HDU 4493 Tutor(精度处理)的更多相关文章
- hdu 4493 Tutor 水题
Tutor Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4493 D ...
- HDU 4493 Tutor 水题的收获。。
题目: http://acm.hdu.edu.cn/showproblem.php?pid=4493 题意我都不好意思说,就是求12个数的平均数... 但是之所以发博客,显然有值得发的... 这个题最 ...
- hdu 4493 Tutor
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4493 给你十二个月的工资,算平均数,保留两位,去除末尾的0 使用暴力解决,嘻嘻,但是这题主要是在进位这个地 ...
- HDU 4493 Tutor (控制精度)
题意:给定12个数,求平均数. 析:这个题就是精度控制问题,如果控制精度,最好的办法就是用整型了. 代码如下: #include <cstdio> #include <string& ...
- HDU 4493 Tutor (水题)
Tutor Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submi ...
- Hdu 5073 Galaxy 精度问题
思路: 其实求解很简单直接说解法,移动K个后 上下的角动量最小,能肯定是相连的(n-k)个,至于为什么 你自己好好想想(easy): 对于一些等质量的质点中心在 所在位置和除以点的个数 average ...
- Hdu 4493
题目链接 注意四舍五入,保留到小数点后两位(如果存在的话). 附上代码: /************************************************************** ...
- HDU 1007 Quoit Design(二分+浮点数精度控制)
Quoit Design Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) To ...
- [HDU - 5170GTY's math problem 数的精度类
题目链接:HDU - 5170GTY's math problem 题目描述 Description GTY is a GodBull who will get an Au in NOI . To h ...
随机推荐
- ruby cookbook
11.2 listing object's method Oject.methods/singleton_methods/instance_methods 指定类名定义的方法在 singleton_m ...
- 安装使用rspec
一,安装ruby. 二,运行命令,安装rspec的gem包: gem install rspec 会看到如下的结果: Fetching: rspec-core-2.14.7.gem (100%) Fe ...
- LaTex中让页码从正文开始编号
在正文和目录之前这样设置即可 \setcounter{page}{}
- Python sequence (序列)
序列简介 sequence 是一组有序元素的组合 序列可以是多个元素,也可以一个元素都没有 序列有2种:tuple(定值表).List(表) D:\python\Python_Day>pytho ...
- JSAPI_Ticket签名
1.微信 JS 接口签名校验工具 2.具体开发 2.1 获取access_token,然后jsapi_ticket /** * 获取access_token,然后jsapi_ticket */ pri ...
- "奇葩家园“之genymotion工具篇
genymotion 简直就是android开发者的福音,比android内置的模拟器不知道快多少, 具体的安装可以参考如下: 1.登陆官方网站,必须先注册 https://www.genymotio ...
- Android编程: 环境搭建、基本知识
学习的内容两个方面:环境搭建.基本知识 ====环境搭建==== 1.下载 android studio(http://developer.android.com/sdk/index.html) 2. ...
- 44.do文件格式
style1: transcript onif {[file exists rtl_work]} {<span style="white-space:pre"> < ...
- 了解struts2 action的一些原理
今天在struts2中的 action方法中,打印了一下当前action,即this,还打印了一下当前action引用的service, 在页面中访问该action方法2次,发现action是不一样的 ...
- 四则运算2扩展---c++
题目:让程序能接受用户输入答案,并判定对错.最后给出总共对/错 的数量. 一.设计思想 1.存储用户输入答案,与正确答案比较得出总共对错数量. 二.源程序代码 #include<iostream ...