错哪了
Problem Description
Your task is to Calculate the sum of some integers.
Input
Input contains multiple test cases. Each test case contains a integer N, and then N integers follow in the same line. A test case starting with 0 terminates the input and this test case is not to be processed.
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
4 1 2 3 4
5 1 2 3 4 5
0
Sample Output
10
15
我的代码是
#include <stdio.h>
#include<stdlib.h>
int main()
{
int n,temp=0,sum=0;
scanf("%d",&n);
while(n--)
{
scanf("%d",&temp);
while(temp)
{
sum+=temp;
printf("%d\n",sum);
}
}
return 0;
}
错哪了?
Your task is to Calculate the sum of some integers.
Input
Input contains multiple test cases. Each test case contains a integer N, and then N integers follow in the same line. A test case starting with 0 terminates the input and this test case is not to be processed.
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
4 1 2 3 4
5 1 2 3 4 5
0
Sample Output
10
15
我的代码是
#include <stdio.h>
#include<stdlib.h>
int main()
{
int n,temp=0,sum=0;
scanf("%d",&n);
while(n--)
{
scanf("%d",&temp);
while(temp)
{
sum+=temp;
printf("%d\n",sum);
}
}
return 0;
}
错哪了?
...全文
相关推荐
MATLAB图像错切_matlab_图像处理_水平错切_图像错切_
**创建错切矩阵**:定义错切因子,然后构建变换矩阵。
3_层错与孪晶,孪晶与层错能的关系,Unix_Linux
层错能和孪晶形成能是衡量这两种缺陷稳定性的关键参数。层错能是指恢复原始无缺陷晶体结构所需的能量,其值越高,层错越不稳定,越容易移动或消失。
unity cgshader错切变换
例如,X轴错切会在YZ平面上产生效果,使得物体沿X轴的方向被拉伸或压缩;同样,Y轴错切会影响ZX平面,而Z轴错切则作用在XY平面上。
蕨叶错切变换
**错切变换的数学原理**: 错切变换可以通过矩阵乘法来实现。
错台计算原理
在错台数据中,由于数据在错台两侧可能呈现出高斯噪声特性,因此使用均值滤波可以有效地平滑数据,突出错台的特征。然后是中值滤波,它是一种非线性的平滑技术,尤其适合消除椒盐噪声。



