题解
#include <stdio.h> int main(void) { int *a; int n; int i=0,cout=0; scanf("%d",&n); while(n!=0){ a = malloc(sizeof(int)*n); cout = 0; for(i=0;i<n;i++){ scanf("%d",&a[i]); } for(i=0;i<n;++i) { cout += a[i]; } printf("%d\n",cout); scanf("%d",&n); } return 0; }