lightoj 1015

水题,统计大于0的和。

#include<cstdio>
int main(){
    int t, n, tmp;
    scanf("%d", &t);
    for(int i = 1;i <= t;i ++){
        scanf("%d", &n);
        int sum = 0;
        for(int j = 0;j < n;j ++){
            scanf("%d", &tmp);
            sum += tmp > 0 ? tmp : 0;
        }
        printf("Case %d: %d
", i, sum);
    }
}


原文地址:https://www.cnblogs.com/anhuizhiye/p/3933165.html