题解 | 数字求和
数字求和
https://www.nowcoder.com/practice/e8cee01f2d834fa9ba3479fafe492b65
#include <stdio.h>
int main() {
int a[5], b=0,c;
while (scanf("%d", &c) != EOF) { // 注意 while 处理多个 case
// 64 位输出请用 printf("%lld") to
for(int i=0;i<=4;i++){
scanf("%d",&a[i]);
if(a[i]<c) b+=a[i];
}
printf("%d\n", b);
}
return 0;
}
注意对数组的赋值


查看29道真题和解析