1014 Metro line Line 3

Source: Internet
Author: User

Qingdao Metro3The northern section of the line has been12Month16 dot officially open, site total 10 A, from north to south including Qingdao North railway station, Yongping Road station, Zhenhua Road station, June Feng Road station, Li Cun Station, years Spring Road station, Haier Road station, Metro Tower Station, Changsha Road station, Shuangshan station, the total mileage about 12 km. Suppose that each stop minutes, given the time between any two stations, calculate the number of minutes from the first site to the last site.

The first line in the input data is a positive integer t(0<t<10), followed by the T- row data.

        The first of each row of data is an integer (1<n<10 minute, this is because it is the first site given.

The output has T-line data.

An integer per line that represents the number of minutes from the first site to the last site.

2
5 0 3 2 4 1
3 0 4 2
34
14

#include "stdio.h"
int main ()
{
int n,i,j,a[12],m,sum;
scanf ("%d", &n);
for (i=0;i<n;i++)
{
sum=0;
scanf ("%d", &m);
for (j=0;j<m;j++)
{
scanf ("%d", &a[j]);
}
if (m>2) {
Sum= (m-2) *8;
}
for (j=0;j<m;j++) {
SUM=SUM+A[J];
}
printf ("%d\n", sum);
}
return 0;
}

1014 Metro line Line 3

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.