复习时间

复习时间

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 8422    Accepted Submission(s): 6181


Problem Description
为了能过个好年,xhd开始复习了,于是每天晚上背着书往教室跑。xhd复习有个习惯,在复习完一门课后,他总是挑一门更简单的课进行复习,而他复习这门课的效率为两门课的难度差的平方,而复习第一门课的效率为100和这门课的难度差的平方。xhd这学期选了n门课,但是一晚上他最多只能复习m门课,请问他一晚上复习的最高效率值是多少?
 

Input
输入数据的第一行是一个数据T,表示有T组数据。
每组数据的第一行是两个整数n(1 <= n <= 40),m(1 <= m <= n)。
接着有n行,每行有一个正整数a(1 <= a <= 100),表示这门课的难度值。
 

Output
对于每组输入数据,输出一个整数,表示最高效率值。
 

Sample Input
  
  
2 2 2 52 25 12 5 89 64 6 43 56 72 92 23 20 22 37 31
 

Sample Output
  
  
5625 8836
 

Author
xhd
 

Source
 

Recommend
lcy   |   We have carefully selected several similar problems for you:   2079  2076  2082  2077  2073 
 
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<cstdlib>
#include <set>
#include<algorithm>
#include <limits.h>
#include <ctype.h>
#include <map>
#include <stack>
typedef long long LL;
using namespace std;
const int N = 105;
int data[N][N];
int dp[N][N];
int f[35];
char c[6] = {'A', 'B', 'C', 'D', 'E', 'F'};
float obj[5];
void fun(int n, int m)
{
    int flag = 0;
    if(n < 0){
        flag = 1;
        n = -n;
    }
    stack<char> s1;
    while(n != 0){
        int yushu = n % m;
        if(yushu >= 10){
            s1.push(c[yushu - 10]);
        }else {
            s1.push(yushu + '0');
        }
        n =  n / m;
    }
    if(flag){
        cout << "-";
    }
    while(!s1.empty()){
        cout << s1.top();
        s1.pop();
    }
    cout << endl;
}
int gcd(int a, int b)
{
    return b == 0 ? a : gcd(b, a % b);
}
int lcm(int a, int b)
{
    return a  / gcd(a, b) * b;
}

int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
//    int n, sum;
//    while(scanf("%d %d", &n, &sum) != EOF){
//        if(n == 0 && sum == 0) break;
//        for(int i = 1; i <= n; i++){
//            int T = 0;
//            for(int j = i; j <= n; j++){
//                T += j;
//                if(T == sum ){
//                    cout << "["<< i << "," << j <<"]"<< endl;
//                    break;
//                }else if(T < sum){
//                    continue;
//                }else {
//                    break;
//                }
//            }
//        }
//        cout << endl;
//    }
    int T;
    cin >> T;
    while(T--){
        int n, m;
        cin >> n >> m;
        vector<int> v1;
        for(int i = 0; i < n; i++){
            int temp;
            cin >> temp;
            v1.push_back(temp);
        }
        sort(v1.begin(), v1.end());
        cout << (100 - v1[0]) * (100 - v1[0]) << endl;
    }
    return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值