Small Q Series Story--Love in the elevator
Time limit:300/100 MS (java/others) Memory limit:65535/32768 K (java/others)
Total submission (s): 3626 Accepted Submission (s): 2284
Problem Description Careful colleague found, small Q recently like to take the elevator up and down, the reason, perhaps only small q himself know: In the elevator can often meet his heart goddess Hr.
Elevator is actually a very ambiguous place, only in the elevator, small q have the courage so close to the goddess, although feel a little uncomfortable, but the number of times, the goddess is also accustomed to the existence of small q, even familiar with the seemingly not to say that they do not feel suitable for the sentence. However, their conversation is limited to today's weather is good ah or you eat it, often in the other side smiled and nodded once again into the embarrassing silence. So, the little q in accompany Goddess at the same time, also pay attention to the elevator in the floor number shown, and he noticed that the elevator every up to run a layer takes 6 seconds, down to run a layer takes 4 seconds, each door need 5 seconds each time (if someone arrives to open the door), and each next person needs to add 1 seconds.
In particular, the elevator was first on the 0 floor and must be returned to the 0 floor to be counted as the end of the mission. Assuming that everyone in the elevator is going to the floor at the beginning, can you calculate the total time required to complete the mission?
This is a very simple question, you know, little Q has been practicing to quickly mental arithmetic out of the realm of results, now you have to program to try it!
Input inputs first contain a positive integer c, which indicates that there is a C set of test cases.
The next row of C each row contains a set of data, each set of data is a positive integer n, indicating the number of people who take the elevator, and then the n positive integer AI, respectively, to indicate the floor you want to go.
[Technical specification]
c<=100
N<=15
ai<=100
Output please calculate and export the time required to complete a task, with one row for each set of data output.
Sample Input24 2 4 3 2 3 10 10 10
Sample Output59108
#include <stdio.h> #include <string.h> #include <cstdio> #include <string> #include <math.h > #include <algorithm> #define LL long long#define PI atan (1.0) *4#define DD double#define MAX 300#define mod 100#de Fine Dian 1.000000011#define INF 0x3f3f3fusing namespace Std;int s[max];int main () {int n,m,j,i,t,k,a;scanf ("%d", &t) ; while (t--) {scanf ("%d", &n), if (n==0) { printf ("0\n"); Continue;} int Max=-1000;memset (s,0,sizeof (s)); for (i=0;i<n;i++) {scanf ("%d", &a); s[a]++; Max=max (max,a);} int Sum=0;for (i=0;i<=max;i++) { if (S[i])
hdu4505 Small Q Series Story--Love in the elevator