Submission #750048

# Submission time Handle Problem Language Result Execution time Memory
750048 2023-05-29T05:41:05 Z sumit_kk10 Modsum (NOI12_modsum) C
Compilation error
0 ms 0 KB
#include <stdio.h>
#include<stdlib.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:20:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |     scanf("%d", &n);
      |     ^~~~~~~~~~~~~~~
modsum.c:24:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         scanf("%d %d", &v[i], &w[i]);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cclytft8.o: in function `computeSum':
modsum.c:(.text+0xaa): undefined reference to `pow'
collect2: error: ld returned 1 exit status