Submission #750042

# Submission time Handle Problem Language Result Execution time Memory
750042 2023-05-29T05:18:18 Z kalamazoo Modsum (NOI12_modsum) C
Compilation error
0 ms 0 KB
#include <stdio.h>
#include <math.h>

int computeSum(int currentSum, int currentIndex, int n, int v[], int w[]) {
    if (currentIndex == n) {
        return (((int)(pow(currentSum,4)) + 2*(int)(pow(currentSum,2))) % 5 )+ 1;
    }

    int tempSum = 0;
    for (int i = v[currentIndex]; i <= w[currentIndex]; i++) {
        tempSum += computeSum((currentSum + i) % 5, currentIndex + 1, n, v, w);
    }

    return tempSum;
}

int main() {
    int n;
    scanf("%d", &n);

    int v[n], w[n];
    for (int i = 0; i < n; i++) {
        scanf("%d %d", &v[i], &w[i]);
    }

    int sum = computeSum(0, 0, n, v, w);
    printf("%d\n", sum);

    return 0;
}

Compilation message

modsum.c: In function 'main':
modsum.c:19:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |     scanf("%d", &n);
      |     ^~~~~~~~~~~~~~~
modsum.c:23:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         scanf("%d %d", &v[i], &w[i]);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccaWf4om.o: in function `computeSum':
modsum.c:(.text+0xaa): undefined reference to `pow'
collect2: error: ld returned 1 exit status