Easy Marks
来源:互联网 发布:卸载程序找不到软件 编辑:程序博客网 时间:2024/06/06 15:46
The marks distribution in Amazing International University-Bangladesh is very strange. There are lots of quizzes in a semester. The average of all the quizzes is considered as the final mark. Unlike Tom Cruise, his friend Ananta Jalil thinks it is very easy to get specific average marks in this system. So Ananta made a bet with Tom that he can get exactly K average marks in a semester.
After N quizzes there is only one quiz left and Ananta wants to know the minimum number he needs in the last quiz to get exactly K average marks (Integer division) in this semester. Now as a friend of Ananta Jalil you got to help him to win this bet. It is guaranteed that Ananta will need some positive number in the last quiz to get Kfinal marks.
Input
Input starts with an integer T (≤ 100), denoting the number of test cases. Each of the test cases consists of two lines. First line contains two integers N (1≤N≤10)and K (1≤K≤100). The second line contains N integers ai (0≤ai≤100) describing the numbers Ananta already got from the previous Nquizzes.
Output
For each case print the case number and the minimum number Ananta needs in the last quiz to get exactly K average marks. It is guaranteed that the valid output of the input set will always be positive and ≤100.
Example
Input:2
4 50
40 70 35 45
3 20
25 15 20Output:Case 1: 60
Case 2: 20
啥也不说了,上代码:
#include<cstdio>using namespace std;int main(){ int n; while(scanf("%d",&n)!=EOF) { int a,b,c,sum; for(int i=1;i<=n;i++) { sum=0; scanf("%d %d",&a,&b); for(int j=0;j<a;j++) { scanf("%d",&c); sum+=c; } int ans=b*(a+1)-sum; printf("Case %d: %d\n",i,ans); } }}
- Easy Marks
- marks
- Marks
- A. Marks
- Marks Distribution
- 【marks】testing
- 【marks】mongodb
- 【marks】Unity3D
- A. Marks
- Jury Marks
- easy
- Easy
- Nothing but for marks
- spoj 839 Opitmal marks
- spoj 839(Optimal Marks)
- spoj839(Optimal Marks)
- spoj 839 Optimal Marks
- SPOJ 839 Optimal Marks
- Myeclipse10.x注册激活
- 把字符串转换成对象
- (c++)现有有N个学生的数据记录,每个记录包括学号、姓名、三科成绩。 编写一个函数input,用来输入一个学生的数据记录。 编写一个函数print,打印一个学生的数据记录。 在主函数调用这两个函数,
- 蓝桥杯之奇怪的比赛
- Gson 解析教程
- Easy Marks
- 3-3
- python初学三 函数
- 用 WEKA 进行数据挖掘,第 1 部分: 简介和回归
- 从实例中认识指针变量
- 【狂云歌之unity_vr】unity里获取text中文字宽度并截断省略
- 【BZOJ】3997: [TJOI2015]组合数学
- 16.SpringMVC流程及知识总结
- 3-4