【题目链接】: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»的更多相关文章

  1. 【codeforces 415D】Mashmokh and ACM(普通dp)

    [codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...

  2. 【35.02%】【codeforces 734A】Vladik and flights

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  3. 【33.33%】【codeforces 586D】Phillip and Trains

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  4. 【30.43%】【codeforces 746C】Tram

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  5. 【codeforces 707E】Garlands

    [题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...

  6. 【codeforces 707C】Pythagorean Triples

    [题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...

  7. 【codeforces 709D】Recover the String

    [题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...

  8. 【codeforces 709B】Checkpoints

    [题目链接]:http://codeforces.com/contest/709/problem/B [题意] 让你从起点开始走过n-1个点(至少n-1个) 问你最少走多远; [题解] 肯定不多走啊; ...

  9. 【codeforces 709C】Letters Cyclic Shift

    [题目链接]:http://codeforces.com/contest/709/problem/C [题意] 让你改变一个字符串的子集(连续的一段); ->这一段的每个字符的字母都变成之前的一 ...

随机推荐

  1. 【CodeForces 271D】Good Substrings

    [链接] 我是链接,点我呀:) [题意] [题解] 字典树 我们可以两重循环(i,j) 来枚举所有的子串 即i=1,j=1,2,3... i=2,j = 2,3,4,.. 于是我们在i变化的时候(就是 ...

  2. 【hdu 6438】Buy and Resell

    [链接] 我是链接,点我呀:) [题意] 有一个物品的价格在1..n这些位置各不相同. 你初始有无限的钱. 问你从1走到n. 你每次可以选择买入一个或者卖出一个该种物品(或啥都不做) 问你最后的最大利 ...

  3. Qt QImage与OpenCV Mat转换

    本系列文章由 @yhl_leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/51029382 应一个朋友的要求,整理总 ...

  4. [Design]制作磨砂效果

    比较适合运用到网页或者APP的设计当中,推荐过来和飞特的朋友们一起分享学习了,先来看看最终的效果图吧 具体的制作步骤如下:

  5. POJ 2191

    只会打表 #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring ...

  6. Android中XML解析,保存的三种方法

    简单介绍 在Android开发中,关于XML解析有三种方式,各自是: SAX 基于事件的解析器.解析速度快.占用内存少.非常适合在Android移动设备中使用. DOM 在内存中以树形结构存放,因此检 ...

  7. 朴素贝叶斯python实现

    概率论是非常多机器学习算法基础,朴素贝叶斯分类器之所以称为朴素,是由于整个形式化过程中仅仅做最原始.简单的如果. (这个如果:问题中有非常多特征,我们简单如果一个个特征是独立的.该如果称做条件独立性, ...

  8. JAVA Excel API学习案例

    先贴代码吧,执行一下.看看效果,然后看看凝视,再看看代码后面的基础介绍 创建一个新excel并写入数据: public static void myExcel2() throws IOExceptio ...

  9. iOS9中,swift判断相机,相册权限,选取图片为头像

    在iOS7以后要打开手机摄像头或者相册的话都需要权限,在iOS9中更是更新了相册相关api的调用 首先新建一个swift工程,在SB中放上一个按钮,并在viewController中拖出点击事件 ok ...

  10. jqueryui slider

    <!doctype html><html lang="en"><head> <meta charset="utf-8" ...