百度之星程序设计大赛 B题
View Code
1 #include<stdio.h> 2 #include<stdlib.h> 3 4 int main() 5 { 6 int i,n,a,b,sum,ncases,m; 7 8 scanf("%d",&ncases); 9 while( ncases-- ) 10 { 11 scanf("%d",&n); 12 sum = 0; 13 for(i=0; i<n; i++) 14 { 15 scanf("%d",&m); 16 sum += m; 17 } 18 sum = sum - (n-1); 19 printf("%d\n",sum); 20 } 21 22 return 0; 23 }