3 solutions

  • 0
    @ 2024-12-8 23:04:03

    #include <stdio.h> int main() { int n,i; long long int sum=0,p[10000]; scanf("%d", &n); for(i=1;i<=n;i++) { scanf("%lld", &p[i]); if(p[i]>0)sum += p[i]; else { sum += (p[i] *i); } } printf("%lld\n", sum); return 0; }

    Information

    ID
    267
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    3
    Tags
    # Submissions
    527
    Accepted
    128
    Uploaded By