Review time
Time limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 6586 Accepted Submission (s): 4854
Problem description In order to have a good year, XHD began to review, so every night carrying books to the classroom run. XHD Review has a habit, after reviewing a course, he always pick a more simple lesson to review, and he review the efficiency of the course for two courses of the difficulty of the square, and review the efficiency of the first course for 100 and this course of the square of the difficulty difference. XHD This semester chose N course, but one night he can only review M course, ask him to review the maximum efficiency of the night is how much?
The first line of input data is a data T, which indicates that there is a T group of data.
The first line of data for each group is two integers n (1 <= n <=), m (1 <= m <= N).
Then there are n rows, each with a positive integer a (1 <= a <= 100), indicating the difficulty of the course.
Output for each set of input data, outputs an integer that represents the highest efficiency value.
Sample Input22 2522512 589646435672922320223731
Sample Output56258836
Authorxhd
SOURCEACM Program Design Final Exam _ warm-up (thanks to Xhd & 8600) Super water problem, because each time is to find a more simple problem, so directly find the smallest problem is good. Test instructions: Chinese question, very good understanding. Attached code:
1#include <iostream>2#include <cstdio>3#include <cstring>4#include <algorithm>5#include <cmath>6 using namespacestd;7 intMain ()8 {9 intt,i,j,n,m,s;Ten inta[ -]; Onescanf"%d",&T); A while(t--) - { -s= -; thescanf"%d%d",&n,&m); - for(i=0; i<n; i++) - { -scanf"%d",&a[i]); + if(s>A[i]) -s=A[i]; + } Aprintf"%d\n",(int) Pow (( --s),2)); at } - return 0; -}
Hdu 2078 Review Time