Submission #544445

#TimeUsernameProblemLanguageResultExecution timeMemory
544445rainboyJump (BOI06_jump)C11
100 / 100
8 ms4144 KiB
#include <stdio.h> #define N 100 #define L 100 void add(int *aa, int *bb) { int i; for (i = 0; i < L; i++) aa[i] += bb[i]; for (i = 0; i < L; i++) if (aa[i] >= 10) { if (i + 1 < L) aa[i + 1] += aa[i] / 10; aa[i] %= 10; } } int main() { static int dp[N][N][L]; int n, i, j; scanf("%d", &n); dp[0][0][0] = 1; for (i = 0; i < n; i++) for (j = 0; j < n; j++) { int a; scanf("%d", &a); if (a == 0) continue; if (i + a < n) add(dp[i + a][j], dp[i][j]); if (j + a < n) add(dp[i][j + a], dp[i][j]); } i = L - 1; while (i > 0 && dp[n - 1][n - 1][i] == 0) i--; while (i >= 0) printf("%d", dp[n - 1][n - 1][i--]); printf("\n"); return 0; }

Compilation message (stderr)

jump.c: In function 'main':
jump.c:23:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
jump.c:29:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |    scanf("%d", &a);
      |    ^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...