60分,第2,3测试点没过,求助
查看原帖
60分,第2,3测试点没过,求助
1465543
Summer77777楼主2024/12/20 00:12
#include <stdio.h>
#define MAX_ELEMENTS 30
int main() {
    int s[MAX_ELEMENTS];
    int n = 0;
    long long total_sum = 0;
    while (scanf("%d", &s[n]) != EOF) {
        n++;
    }

     for (int i = 0; i < n; i++) {
        total_sum += s[i] * (1 << (n - 1)); 
		}

    printf("%lld\n", total_sum);
    return 0;
}
2024/12/20 00:12
加载中...