【codeforces 810A】Straight «A»
【题目链接】:http://codeforces.com/contest/810/problem/A
【题意】
有n门课的成绩,和一个整数k代表每门课的满分都是k分;
然后这n门课的成绩是按照平均分算的;
且最后的成绩是平均分四舍五入之后得到的一个整数;
问你再加几门满分成绩的科目,最后得到的n门课的成绩四舍五入之后结果为k;(即满分);
【题解】
傻逼模拟题。
一直增加就好;
【Number Of WA】
0
【完整代码】
#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ms(x,y) memset(x,y,sizeof x)
#define Open() freopen("F:\\rush.txt","r",stdin)
#define Close() ios::sync_with_stdio(0),cin.tie(0)
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 110;
int n,ans = 0;
double k,tot=0;
int a[N];
int main()
{
//Open();
Close();//scanf,puts,printf not use
//init??????
cin >> n >> k;
rep1(i,1,n)
{
cin >> a[i];
tot+=a[i];
}
double temp = tot/(1.0*n);
while (temp<k-0.5)
{
ans++;
n++;
tot+=k;
temp = tot/(1.0*n);
}
cout << ans << endl;
return 0;
}
【codeforces 810A】Straight «A»的更多相关文章
- 【codeforces 415D】Mashmokh and ACM(普通dp)
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...
- 【35.02%】【codeforces 734A】Vladik and flights
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- 【33.33%】【codeforces 586D】Phillip and Trains
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- 【30.43%】【codeforces 746C】Tram
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- 【codeforces 707E】Garlands
[题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...
- 【codeforces 707C】Pythagorean Triples
[题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...
- 【codeforces 709D】Recover the String
[题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...
- 【codeforces 709B】Checkpoints
[题目链接]:http://codeforces.com/contest/709/problem/B [题意] 让你从起点开始走过n-1个点(至少n-1个) 问你最少走多远; [题解] 肯定不多走啊; ...
- 【codeforces 709C】Letters Cyclic Shift
[题目链接]:http://codeforces.com/contest/709/problem/C [题意] 让你改变一个字符串的子集(连续的一段); ->这一段的每个字符的字母都变成之前的一 ...
随机推荐
- ajax提交数据遇到400异常,原因及解决方案
开发中遇到的问题, ajax的URL写的正确但是确无法正常跳转, 开发者模式下显示请求400异常. 前后台代码如下 ------------------------------------------ ...
- C/C++ 获取文件夹下的所有文件列表
本系列文章由 @yhl_leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/51009608 提供一段C/C++代码示 ...
- HDU2147 kiki's game
/* HDU2147 kiki's game 博弈论 巴什博奕 http://acm.hdu.edu.cn/showproblem.php?pid=2147 题意:在一个n×m的棋盘上,初始棋子放在右 ...
- BA-siemens-BA模块特性
PXC24(包含UEC24的模块特性) DO点可以接220vac的电压,渠道人员告知电流不要超过2A AO点只能输出0-10V的电压,不能输出4-20ma的电流,说明书上是错误的 AO点输出10v失败 ...
- BA--暖通系统常见设计细节要点
(一)系统设计问题 1.水泵在系统的设计位置: 一般而言,冷冻水泵应设在冷水机组前端,从末端回来的冷冻水经过冷冻水泵打回冷水机组:冷却水泵设在冷却水进机组的水路上,从冷却塔出来的冷却水经冷却水泵打回机 ...
- Toast分析——实现自己的Toast
android 4.0以后,新增了一个功能:关闭某个应用发出的通知.Toast等.详细操作为:打开应用安装列表.找到要屏蔽的应用(长按通知,点击弹出的"应用信息",就可以跳到应用信 ...
- AWR系列之中的一个——AWR简单介绍
AWR的全称是Automatic Workload Repository(自己主动负载知识库). 它是通过对照两次快照的方式收集到统计信息.来生成txt或者html页面形式的报告. 通常,通过AWR报 ...
- R语言基础-数组和列表
数组(array) 一维数据是向量,二维数据是矩阵,数组是向量和矩阵的直接推广,是由三维或三维以上的数据构成的. 数组函数是array(),语法是:array(dadta, dim),当中data必须 ...
- 如何在rul中添加图片
先制作要添加的ico图,如faction.ico 在<title>使用 <link rel="icon" href="../images/faction ...
- xBIM 学习与应用系列目录
xBIM 实战04 在WinForm窗体中实现IFC模型的加载与浏览 xBIM 实战03 使用WPF技术实现IFC模型的加载与浏览 xBIM 实战02 在浏览器中加载IFC模型文件并设 ...