#include<stdio.h> int main() { int n; int c = 0; int num[105]; while(~scanf("%d",&n)) { c++; long long int sum = 0; for(int i = 0; i<= n; i++) { scanf("%d",&num[i]); } for(int i = 1; i < n ; i++) { sum += num[0]*num[i]*num[i+1]; } printf("Case #%d: %lld ",c,sum); } return 0; }
参考:
https://blog.csdn.net/qq_30622831/article/details/82730986