武汉科技大学ACM :1005: A+B for Input-Output Practice (V)

Problem Description

Your task is to calculate the sum of some integers.

Input

Input contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line.

Output

For each group of input integers you should output their sum in one line, and with one line of output for each line in input.

Sample Input

2
4 1 2 3 4
5 1 2 3 4 5

Sample Output

10
15
 1 #include <iostream>
 2 using namespace std;
 3
 4 int main()
 5 {
 6     int T;
 7     cin >> T ;
 8     while(T--)
 9     {
10         int N,sum = 0;
11         cin >> N;
12         while (N--)
13         {
14             int i;
15             cin >> i;
16             sum += i;
17         }
18         cout << sum << endl;
19     }
20
21     return 0;
22 }  
时间: 2024-10-12 21:01:01

武汉科技大学ACM :1005: A+B for Input-Output Practice (V)的相关文章

武汉科技大学ACM :1001: A+B for Input-Output Practice (I)

Problem Description Your task is to Calculate a + b. Too easy?! Of course! I specially designed the problem for acm beginners.  You must have found that some problems have the same titles with this one, yes, all these problems were designed for the s

武汉科技大学ACM :1007: A+B for Input-Output Practice (VII)

Problem Description Your task is to Calculate a + b. Input The input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line. Output For each pair of input integers a and b you should output the sum

武汉科技大学ACM :1002: A+B for Input-Output Practice (II)

Problem Description Your task is to Calculate a + b. Input Input contains an integer N in the first line, and then N lines follow. Each line consists of a pair of integers a and b, separated by a space, one pair of integers per line. Output For each

武汉科技大学ACM :1008: A+B for Input-Output Practice (VIII)

Problem Description Your task is to calculate the sum of some integers. Input Input contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line. Output For each grou

武汉科技大学ACM:1006: 我是老大

Problem Description 今年是2021年,正值武汉科技大学 ACM俱乐部成立10周年.十周年庆祝那天,从ACM俱乐部走出去的各路牛人欢聚一堂,其乐融融.庆祝晚会上,大家纷纷向俱乐部伸出援手,帮助俱乐部度过 经济难关(经费严重不足).其中就职于谷歌的BobLee.Facebook的YYD,自己创办ILOVEMCB公司的MCB,苹果的明爷,IBM的胖富 帅,微软的男神坐在一桌上.胖富帅说我捐a万美元,明爷说a万美元算什么我捐你的两倍,男神说我捐你们两和的4/5,YYD说你们太年轻了,

武汉科技大学ACM:1005: Soapbear and Honey

Problem Description Soapbear is the mascot of WHUACM team. Like other bears, Soapbear loves honey very much, so he decides to get some honeycombs for honey. There are N honeycombs hanging on some trees, numbered from 1 to N, and the height of honeyco

武汉科技大学ACM :1005: C语言程序设计教程(第三版)课后习题6.6

Problem Description 打印出所有"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该本身. 例如:153是一个水仙花数,因为153=1^3+5^3+3^3. Output: 153 ??? ??? ??? Input 无 Output 所有的水仙花数,从小的开始. 每行一个 Sample Input Sample Output 1 #include<stdio.h> 2 3 #include<math.h>

武汉科技大学ACM :1005: 零起点学算法101——手机短号

Problem Description 大家都知道,手机号是一个11位长的数字串,同时,作为学生,还可以申请加入校园网,如果加入成功,你将另外拥有一个短号.假设所有的短号都是是 6+手机号的后5位,比如号码为13512345678的手机,对应的短号就是645678. 现在,如果给你一个11位长的手机号码,你能找出对应的短号吗? Input 输入数据的第一行是一个N(N <= 200),表示有N个数据,接下来的N行每一行为一个11位的手机号码. Output 输出应包括N行,每行包括一个对应的短号

武汉科技大学ACM :1005: 一二三

Problem Description 你弟弟刚刚学会写英语的一(one).二(two)和三(three).他在纸上写了好些一二三,可惜有些字母写错了.已知每个单词最多有一个字母写错了(单词长度肯定不会错),你能认出他写的啥吗? Input 第一行为单词的个数(不超过10).以下每行为一个单词,单词长度正确,且最多有一个字母写错.所有字母都是小写的. Output 对于每组测试数据,输出一行,即该单词的阿拉伯数字.输入保证只有一种理解方式. Sample Input 3 owe too thee