HDU 4493 Tutor(精度处理)】的更多相关文章

题目 #include<stdio.h> int main() { int t; double a,s; scanf("%d",&t); while(t--) { s=; ;i<;i++) { scanf("%lf",&a); s+=a; } //1.注意案例的输出格式 //2.rounded to the nearest penny int ss=s/12.0+0.005; printf("$%d",ss);…
Tutor Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4493 Description Lilin was a student of Tonghua Normal University. She is studying at University of Chicago now. Besides studying, she worked as a tutor tea…
题目: http://acm.hdu.edu.cn/showproblem.php?pid=4493 题意我都不好意思说,就是求12个数的平均数... 但是之所以发博客,显然有值得发的... 这个题最坑的地方就是结果精确到便士,也就是小数点后2位,不输出后缀0,所以需要处理一下输出格式. 一开始我是用c语言这样写的: #include <stdio.h> #include <string.h> int main() { int t; scanf("%d", &a…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4493 给你十二个月的工资,算平均数,保留两位,去除末尾的0 使用暴力解决,嘻嘻,但是这题主要是在进位这个地方要处理好,由于 要去除末尾0,采用一个数组来保存小数点后面的数, 当要进位时,从未到头查看是否是要进位 最后将整数部分输出,然后输出小数部分(满足要求的小数位输出) 代码: #include <stdio.h> int main() { double x,sum; int t,i,j; scan…
题意:给定12个数,求平均数. 析:这个题就是精度控制问题,如果控制精度,最好的办法就是用整型了. 代码如下: #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostream> #include <cstring> #include <set> #include <queue> #include…
Tutor Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 47    Accepted Submission(s): 26 Problem Description Lilin was a student of Tonghua Normal University. She is studying at University of Chic…
思路: 其实求解很简单直接说解法,移动K个后 上下的角动量最小,能肯定是相连的(n-k)个,至于为什么 你自己好好想想(easy): 对于一些等质量的质点中心在 所在位置和除以点的个数 average=sum[l,l+(n-k)-1]/(n-k); 一个点的值: (pi-average)* (pi-average)  也就是 pi^2+avery^2 - 2*pi*average  多个点相加也就是 ∑pi^2+(n-k)*sum*sum/(n-k)/(n-k)   -  2*∑pi*sum/(…
题目链接 注意四舍五入,保留到小数点后两位(如果存在的话). 附上代码: /************************************************************************* > File Name: 4493.cpp > Author: Stomach_ache > Mail: sudaweitong@gmail.com > Created Time: 2014年05月19日 星期一 22时39分19秒 > Propose:…
Quoit Design Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 47104    Accepted Submission(s): 12318 Problem Description Have you ever played quoit in a playground? Quoit is a game in which fla…
题目链接:HDU - 5170GTY's math problem 题目描述 Description GTY is a GodBull who will get an Au in NOI . To have more time to learn algorithm knowledge, he never does his math homework. His math teacher is very unhappy for that, but she can't do anything beca…