ACM (TJU) : 1805


#include <stdio.h>

int main ()
{
    int dataSet;
    scanf ("%d", &dataSet);

    while ( dataSet-- ) {

        int input;
        int maximum = 0;
        bool flag = false;
        int k;
        scanf ("%d", &k);

        for ( int i = 0; i < k; i++ ) {
            scanf ("%d", &input);
            if ( flag )
            maximum += ( input - 1 );
            else
            maximum += input;
            flag = true;
        }

        printf ("%d\n", maximum);

    }

    return 0;
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s