Submission #750049

#TimeUsernameProblemLanguageResultExecution timeMemory
750049sumit_kk10Modsum (NOI12_modsum)C++14
25 / 25
113 ms396 KiB
#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 (stderr)

modsum.cpp: In function 'int main()':
modsum.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
modsum.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         scanf("%d %d", &v[i], &w[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...