UVA 11945 Financial Management 水题
Financial Management
Time Limit: 1 Sec Memory Limit: 256 MB
题目连接
acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id=20184
Description
Michael graduated of ITESO this year and finally has a job. He's making a lot of money, but somehow never seems to have enough. Michael has decided that he needs to grab hold of his financial portfolio and solve his financing problems. The first step is to figure out what's been going on with his money.
Michael has his bank account statements and wants to see how much money he has. Help Michael by writing a program to take his closing balance from each of the past twelve months and calculate his average account balance.
Input
The first line of input contains a single integer N, ( 1
N
100) which is the number of datasets that follow.
Each dataset consists of twelve lines. Each line will contain the closing balance of his bank account for a particular month. Each number will be positive and displayed to the penny. No dollar sign will be included.
Output
For each dataset, you should generate one line of output with the following values: The dataset number as a decimal integer (start counting at one), a space, a character `$', and a single number, the average (mean) of the closing balances for the twelve months. It will be rounded to the nearest penny.
Note: Used comma (,) to separate the thousands.
Sample Input
1
100.00
489.12
12454.12
1234.10
823.05
109.20
5.27
1542.25
839.18
83.99
1295.01
1.75
Sample Output
HINT
题意
啊,给你十二个月的钱,然后求平均钱数,注意在千位打逗号
题解:
加起来除以12咯
代码:
//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 200001
#define mod 10007
#define eps 1e-9
//const int inf=0x7fffffff; //无限大
const int inf=0x3f3f3f3f;
/* */
//**************************************************************************************
inline ll read()
{
int x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
int buf[];
inline void write(int i) {
int p = ;if(i == ) p++;
else while(i) {buf[p++] = i % ;i /= ;}
for(int j = p-; j >=; j--) putchar('' + buf[j]);
printf("\n");
}
int main()
{
int t=read();
for(int cas=;cas<=t;cas++)
{
double sum=;
double x=;
for(int i=;i<;i++)
{
cin>>x;
sum+=x;
}
sum/=;
int a=(int)(sum/);
sum-=a*;
if(a>)
printf("%d $%d,%.2f\n",cas,a,sum);
else
printf("%d $%.2f\n",cas,sum);
}
}
UVA 11945 Financial Management 水题的更多相关文章
- UVa 1339 Ancient Cipher --- 水题
UVa 1339 题目大意:给定两个长度相同且不超过100个字符的字符串,判断能否把其中一个字符串重排后,然后对26个字母一一做一个映射,使得两个字符串相同 解题思路:字母可以重排,那么次序便不重要, ...
- UVa 1225 Digit Counting --- 水题
UVa 1225 题目大意:把前n(n<=10000)个整数顺次写在一起,12345678910111213...,数一数0-9各出现多少字 解题思路:用一个cnt数组记录0-9这10个数字出现 ...
- UVa 1586 Molar mass --- 水题
UVa 1586 题目大意:给出一种物质的分子式(不带括号),求分子量.本题中分子式只包含4种原子,分别为C.H.O.N, 原子量分别为12.01,1.008,16.00,14.01 解题思路:先实现 ...
- UVa 272 Tex Quotes --- 水题
题目大意:在TeX中,左引号是 ``,右引号是 ''.输入一篇包含双引号的文章,你的任务是把他转成TeX的格式 解题思路:水题,定义一个变量标记是左引号还是右引号即可 /* UVa 272 Tex Q ...
- UVa 1583 Digit Generator --- 水题+打表
UVa 1583 题目大意:如果x加上x的各个数字之和得到y,那么称x是y的生成元. 给定数字n,求它的最小生成元 解题思路:可以利用打表的方法,提前计算出以i为生成元的数,设为d,并保存在a[d]中 ...
- UVa 1584 Circular Sequence --- 水题
UVa 1584 题目大意:给定一个含有n个字母的环状字符串,可从任意位置开始按顺时针读取n个字母,输出其中字典序最小的结果 解题思路:先利用模运算实现一个判定给定一个环状的串以及两个首字母位置,比较 ...
- UVa 10970 - Big Chocolate 水题 难度: 0
题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&a ...
- UVa 12342 Tax Calculator (水题,纳税)
今天在uva看到一个水题,分享一下. 题意:制定纳税的总额,有几个要求,如果第一个180000,不纳,下一个300000,纳10%,再一个400000,纳15%,再一个300000,纳20%,以后的纳 ...
- UVA 11039 - Building designing 水题哇~
水题一题,按绝对值排序后扫描一片数组(判断是否异号,我是直接相乘注意中间值越界)即可. 感觉是让我练习sort自定义比较函数的. #include<cstdio> #include< ...
随机推荐
- lombok java代码助手
是不一个不错的代码生成工具,可以实现将代码更精简,且不失代码效率的一种不错的方法 https://www.cnblogs.com/qnight/p/8997493.html 通过java bean v ...
- Spark RDD 窄依赖研究
1.. 简介 spark从RDD依赖上来说分为窄依赖和宽依赖. 其中可以这样区分是哪种依赖:当父RDD的一个partition被子RDD的多个partitions引用到的时候则说明是宽依赖,否则为窄依 ...
- vue总结05 过渡--状态过渡
状态过渡 Vue 的过渡系统提供了非常多简单的方法设置进入.离开和列表的动效.那么对于数据元素本身的动效呢,比如: 数字和运算 颜色的显示 SVG 节点的位置 元素的大小和其他的属性 所有的原始数字都 ...
- 关于卫星RNSS与RDSS
名词解释:RNSS与RDSS 服务于用户位置确定的卫星无线电业务有两种.一种是卫星无线电导航业务,英文全称Radio Navigation Satellite System,缩写RNSS,由用户接收卫 ...
- git —— Feature分支
添加新功能时,新建feature分支 分支上开发完成后,再进行合并.最后删除feature分支 $ git checkout -b feature-vulcan 开发完毕后,切换回添加的分支,进行合并 ...
- 异步消息框架netty
Netty-WebSocket长连接推送服务 http://blog.csdn.net/z69183787/article/details/52505249 http://blog.csdn.net/ ...
- HDU 4632 Palindrome subsequence(区间DP求回文子序列数)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4632 题目大意:给你若干个字符串,回答每个字符串有多少个回文子序列(可以不连续的子串).解题思路: 设 ...
- Eclipse+Tomcat+Axis2+ADT开发环境配置
一.安装Eclipse和Tomcat 1.安装Eclipse: 2.解压缩安装apache-tomcat-6.0.41 3.tomcat配置环境变量(4个) TOMCAT_HOME D:\An ...
- 【POJ】2069.Super Star
题解 求一个最小的半径的球,包括三维平面上所有的点,输出半径 随机移动球心,半径即为距离最远的点,移动的方式是向离的最远的那个点移动一点,之后模拟退火就好 代码 #include <iostre ...
- 安装loadrunner11,卸载360浏览器后提示“无效的应用程序路径!请检查应用程序是否存在!”
我安装的loadrunner是11版本的,安装之前我的电脑上有安装了很多的浏览器,结果一开始录制脚本的时候,页面直接跳转到360浏览器上面了,但是显示正在录制的脚本为0个,于是就把360给卸载了,进行 ...