2705: Skipping games
-
Total time limit:
-
1000ms
-
Memory Limit:
-
65536kB
-
-
Describe
-
-
children play rope skipping competitions, to calculate how many jumps in a minute. Assuming a jump every second, it will take three seconds to start the jump if it fails halfway. The average child jumps a minute to jump a few times. It is now given the total number of hops that a child has jumped each time he jumps, and how many children have jumped within a minute. ( be careful to analyze sample data.)
-
-
Input
-
-
First act n a child
The rest of the rows, the first integer per line is the number of hops, and the remaining m integers are skipped as many times as they are skipped.
-
-
Output
-
The
-
output of the corresponding children jumped in the first minute how many down.
-
-
Sample input
-
-
603 12 23 45 1 174 10 20 30 405 10 20 30 40 58 6 10 20 30 40 47 60
-
-
Sample output
-
-
605157484847
-
-
Tips
-
-
tip, you may have timed out during the skipping game, but you are still counting, but the referee has stopped timing and got the score. Here is quite with oneself counted. Therefore, it is not the time of the first minute that the jump is bad. Note The sample data is analyzed.
-
-
-
-
Code:
-
#include <cstdio>
#include <malloc.h>
#include <algorithm>
using namespace std;
int main ()
{
Freopen ("In.txt", "R", stdin);
int m,i;
int t;
scanf ("%d", &t);
while (t--)
{
scanf ("%d", &m);
int *p= (int*) malloc (sizeof (int) *m);
for (i=0;i<m;i++)
scanf ("%d", &p[i]);
for (i=0;i<m;i++)
{
if (p[i]+3*i>60)
{
if (p[i-1]+3*i>=60)
printf ("%d\n", p[i-1]);
Else
printf ("%d\n", 60-3*i);
Break
}
}
if (i==m)
if (m!=0)
printf ("%d\n", Max (60-3*m,p[m-1]));
Else
printf ("60\n");
Free (p);
}
return 0;
}
Openjudge 2705 Rope Skipping game