【题目链接】: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. 在本地生成ssh-key 免密码远程clone GitLab中的项目到本地

    每次项目push.pull都需要输入账号和密码,很烦,方便免密pull与push代码,在本地需要用git bash 创建一个公钥,然后在gitlab中把公钥保存下来. 步骤如下: 1.打开 git b ...

  2. FreeMarker 整合 springmvc

    一.添加 jar 包 <dependency> <groupId>org.freemarker</groupId> <artifactId>freema ...

  3. C#中的Attribute Property区别

    Attribute 一般译作"特性",Property 仍然译为"属性". Attribute 是一种可由用户自由定义的修饰符(Modifier),可以用来修饰 ...

  4. POJ 2137

    水,dp[i][j][k],设为当前为i个牛,在它喜欢的j个位置,而第一个牛在k个位置,很明显了,其实不过是枚举. #include <iostream> #include <cst ...

  5. SDUT 1225-编辑距离(串型dp)

    编辑距离 Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描写叙述 如果字符串的基本操作仅为:删除一个字符.插入一个字符和将一个字符改动 ...

  6. USACO 1.2 Transformations (模拟)

    模拟题目,依照题目给定的要求变换图形就可以,变换的优先级依次减小. 这个题目我写的非常乱.只是最还还是勉强能够执行 /* ID:twd30651 PROG:transform LANG:C++ */ ...

  7. hdu5386 Cover

    Problem Description You have an n∗n matrix.Every grid has a color.Now there are two types of operati ...

  8. 终端安全工具 gartner 排名

    Reviews for Endpoint Detection and Response Solutions What is Endpoint Detection and Response Soluti ...

  9. 在Maven中引入spring的DAO、DOMAIN、CONTROLLER、VIEW

    除了mysql外麻雀虽小,五脏俱全. 参照之前的博客建立好的maven项目如图. 第一步 : 向maven项目中的pom文件添加依赖 ,然后maven install

  10. web.config配置文件使用总结

    我们在开发web系统的时候,使用web.config进行配置是司空见惯的,那么web.confg到底是什么呢?什么时候使用web.config呢?有几种使用web.config方式呢? 如果不太明白的 ...