Tutor

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)
Total Submission(s): 48 Accepted Submission(s): 27

Problem Description
Lilin was a student of Tonghua Normal University. She is studying at University of Chicago now. Besides studying, she worked as a tutor teaching Chinese to Americans. So, she can earn some money per month. At the end of the year, Lilin wants to know his average monthly money to decide whether continue or not. But she is not good at calculation, so she ask for your help. Please write a program to help Lilin to calculate the average money her earned per month.
 
Input
The first line contain one integer T, means the total number of cases.

Every case will be twelve lines. Each line will contain the money she earned per month. Each number will be positive and displayed to the penny. No dollar sign will be included.
 
Output
The output will be a single number, the average of money she earned for the twelve months. It will be rounded to the nearest penny, preceded immediately by a dollar sign without tail zero. There will be no other spaces or characters in the output.
 
Sample Input
2
100.00
489.12
12454.12
1234.10
823.05
109.20
5.27
1542.25
839.18
83.99
1295.01
1.75
100.00
100.00
100.00
100.00
100.00
100.00
100.00
100.00
100.00
100.00
100.00
100.00
 
Sample Output
$1581.42
$100
 
Source
大坑题啊,不知道错了多少次了!
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main()
{
int n,i,m;
double temp,sum;
scanf("%d",&n);
while(n--)
{
sum=0;
for(i=0;i<12;i++)
{
scanf("%lf",&temp);
sum+=temp;
}
sum=sum/12.0;
int m=(int)(sum*100);
int sum0=(int)(sum*1000);
if(sum0%10>=5)
m+=1;
printf("$%d",m/100);
m=m%100;
if(m%100==0)
{
printf("\n");
}
else if(m%10==0)
{
printf(".%d\n",m/10);
}
else
{
if(m<10)
printf(".0%d\n",m);
else
printf(".%d\n",m);
}
}
return 0;
}

hdu4493 Tutor的更多相关文章

  1. 2013 ACM 通化邀请赛 A. Tutor

    A. Tutor Description Lilin was a student of Tonghua Normal University. She is studying at University ...

  2. hdu 4493 Tutor 水题

    Tutor Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4493 D ...

  3. Python Tutor

    Python Tutor Python Tutor 是由 Philip Guo 开发的一个免费教育工具,可帮助学生攻克编程学习中的基础障碍,理解每一行源代码在程序执行时在计算机中的过程.通过这个工具, ...

  4. linux vim tutor

    ================================================================================      欢     迎     阅  ...

  5. HDU 4493 Tutor (水题)

    Tutor Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submi ...

  6. 详解Android功耗分析工具Power Tutor的使用

    简介: PowerTutor 是由美国密歇根大学在谷歌的指导下开发的.它是用来展示google智能手机中主要组件或应用功耗的一种应用程序.例如,CPU,网络链接,LCD显示屏,GPS等.它允许开发者很 ...

  7. HDU 4493 Tutor(精度处理)

    题目 #include<stdio.h> int main() { int t; double a,s; scanf("%d",&t); while(t--) ...

  8. HDU 4493 Tutor (控制精度)

    题意:给定12个数,求平均数. 析:这个题就是精度控制问题,如果控制精度,最好的办法就是用整型了. 代码如下: #include <cstdio> #include <string& ...

  9. HDU 4493 Tutor 水题的收获。。

    题目: http://acm.hdu.edu.cn/showproblem.php?pid=4493 题意我都不好意思说,就是求12个数的平均数... 但是之所以发博客,显然有值得发的... 这个题最 ...

随机推荐

  1. maven本地jar

    <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId&g ...

  2. 基于MapReduce的HBase开发

    在伪分布式模式和全分布式模式下 HBase 是架构在 HDFS 上的,因此完全可以将MapReduce 编程框架和 HBase 结合起来使用.也就是说,将 HBase 作为底层“存储结构”, MapR ...

  3. 如何捕获winform程序全局异常?(续)

    前言 上篇文章我提供了一种方案可以供我们捕获单线程程序中的所有未处理异常.但是如果程序是多线程,那么新增线程出现了异常上个方案就无能为力了.本着方案总比问题多的态度,我再给大家提供一种新的方案,供大家 ...

  4. SQL模板和模板实例化

    需求:需要得出一个数据源DataTable,我已知SQL和HttpRequest如何,通过SQL模板的方式去实例化匹配HttpRequest中的参数实例化为查询SQL,最后返回DataTable 1. ...

  5. [转]java-Three Rules for Effective Exception Handling

    主要讲java中处理异常的三个原则: 原文链接:https://today.java.net/pub/a/today/2003/12/04/exceptions.html Exceptions in ...

  6. Eclipse用法和技巧十七:覆盖父类方法

    在学校里面学习java,遇到访问权限修饰符一直停留在public是公有的,外面可以访问:protected是对子类可见的,外部不可以访问:private仅在本类中可见.工作之后,接触到了java代码多 ...

  7. Single Image Haze Removal Using Dark Channel Prior翻译

    这段时间在回顾以前做的去雾,顺便就把这篇文章翻译了一下,看看有没有同行交流.由于是用LaTex排版的,所以只能转为图片传上来了.另外,英语水平有限,大部分都是靠词典,所以只能勉强着看了.

  8. html,JavaScript调用winfrom方法

    ---恢复内容开始--- 目的: 在动画上面添加点击事件,通过JavaScript调用winfrom方法 1.创建一个页面 using System; using System.Collections ...

  9. Mongodb 上传图片

    mongdb 上传图片: [root@hy-mrz01 ~]# mongofiles put -u "pics" -p "jh7yxx" --host 127. ...

  10. 1.0.3-学习Opencv与MFC混合编程之---打开本地摄像头

    源代码:http://download.csdn.net/detail/nuptboyzhb/3961643 版本1.0.3新增内容 打开摄像头 Ø 新建菜单项,Learning OpenCV——&g ...