A+B for Input-Output Practice (VIII) 为什么 我在 杭电 上 做是 Presenta

sadkjhsdfigh2022-10-04 11:39:541条回答

A+B for Input-Output Practice (VIII) 为什么 我在 杭电 上 做是 Presentation Error!
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 you must note that there is a blank line between outputs.
Sample Input
3
4 1 2 3 4
5 1 2 3 4 5
3 1 2 3
Sample Output
10
15
6
Author
lcy
Recommend
JGShining
#include
int main( )
{
x05int a,b,i,j,m,n;
while(scanf("%d",&n)!=EOF)
x05{
x05x05for(j=0;j

已提交,审核后显示!提交回复

共1条回复
渔耕之家 共回答了13个问题 | 采纳率84.6%
#include
int main()
{
int N;
scanf("%d",&N);
while(N--)
{
int M,i,a,sum=0;
scanf("%d",&M);
for(i=0;i
1年前

相关推荐

A+B for Input-Output Practice 这是ACM杭大题库的一道题各位大哥大姐们谁知道答案啊?
A+B for Input-Output Practice 这是ACM杭大题库的一道题各位大哥大姐们谁知道答案啊?
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 pair of input integers a and b you should output the sum of a and b in one line,and with one line of output for each line in input.
Sample Input
2
1 5
10 20
Sample Output
6
30
22152721年前1
海不枯 共回答了13个问题 | 采纳率84.6%
题目的翻译是:
题目 计算a+b
输入:首先输入一个N代表下面的行数,然后在下面每行中输入两个数ai和bi,用空格分开.
输出:输出N行,每行输出ai+bi的和.
算法(不知道你会什么语言,所以只拿自然语言描述了):
Step1.获取N,进行标准化判断(即若N不是正整数,则提示错误);
Step2.建立数组A[N];
Step3.For i=1 to N do
{
读入a,b;(更细致一些的话可以加入空格判断,即判断a后第一个不是空格的字符)
将a+b写入A[i];
}
Step4.For i=1 to N do
{
输出A[i];
输出回车键;
}
关于A+B for Input-Output Practice
kikikhe1年前1
坚持到底不放弃 共回答了25个问题 | 采纳率96%
#include
void main()
{
x09int N,i,sum=0,k,j,a;
x09scanf("%d",&N);
x09for (i=0;ix09{
x09x09scanf("%d",&k);
x09x09for (j=0;jx09x09{
x09x09x09scanf("%d",&a);
x09x09x09sum=sum+a;
x09x09}
x09x09printf("%dnn",sum);
x09x09sum=0;
x09}
}