【codeforces 810A】Straight «A»
2017-10-04 18:44
295 查看
【题目链接】: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 ; 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 810A Straight «A» 题解
- codeforces 810A Straight <<A>> 暴力
- codeforces——810A——Straight «A»
- 4000 CodeForces 810A Straight <<A>> 【数学】【模拟】
- 【Codeforces 808 A. Straight «A»】
- CodeFroces 810A Straight «A»
- CodeForces - 724G:Xor-matic Number of the Graph
- codeforces 320
- codeforces 185a(矩阵快速幂)
- 【CODEFORCES】 A. Initial Bet
- 【codeforces 602E】Kleofáš and the n-thlon
- CodeForces 534B Covered Path
- Codeforces 232E - Quick Tortoise bitset+分治
- Codeforces 916-A
- codeforces 327 B. Hungry Sequence
- Internal Sorting: Straight insertion: Sorting by Insertion
- CodeForces 801A Vicious Keyboard 模拟
- 【codeforces 572B】Order Book
- CodeForces 455C Civilization