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. Python 对Twitter中指定话题的被转载Tweet数量的频谱分析

    CODE: #!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2014-7-10 @author: guaguastd @name: r ...

  2. Excel 公式(细节若干)

    查找与引用: 1.如果需要找出匹配元素的位置而不是匹配元素本身,则应该使用 MATCH 函数而不是 LOOKUP 函数. 2.VLOOKUP的第一个参数允许使用通配符“*”来表示包含的意思,把*放在字 ...

  3. 双绞线的制作,T568A线序,T568B线序

    双绞线的制作 1.1 实验目的 双绞线是组建局域网时常常使用的通信传输介质,通过本实验,让学生学会制作双绞线. 1.2 实验任务 (1)了解双绞线的特性及屏蔽与非屏蔽双绞线的区别. (2)了解EIA/ ...

  4. js下firstElementChild firstChild 以及childNodes和children方法

    一. <div> <p>123</p> </div> 在上面这段代码中,如果使用以下js代码 var oDiv=document.getElementB ...

  5. 用lambda表达式声明委托

    首先来分享一段代码: Func<int, int, int> addMethod = (int x, int y) => (x + y); 熟悉的人肯定知道这句话是什么意思,可是不熟 ...

  6. 多屏广告技术调研 & 广告基础介绍

    之前做的多屏广告产品调研,并简单介绍了一些基础广告知识.见ppt:多屏广告技术调研

  7. Ubuntu下安装ADT(图文教程)

    个人感觉Ubuntu下安装ADT跟在Windows大同小异 一.装上JDK和Eclipse 如果还没有装上的,请参考我前面的博文: http://blog.csdn.net/ljphhj/articl ...

  8. 恭喜我开通了CSDN博客

    准备在这里写点东西,记录我的学习过程....

  9. mac 修改系统配置参数 主机名 等

    mac 修改系统配置参数,可以使用 命令 scutil 参考网址: https://developer.apple.com/library/mac/documentation/Darwin/Refer ...

  10. Android自学绝佳资料

    本文转自stormzhang老师的博客:http://stormzhang.com/android/2014/07/07/learn-android-from-rookie 首先感谢stromzhan ...