Submission details
Task:Dice Combinations
Sender:aalto26ch_006
Submission time:2026-09-12 16:58:15 +0300
Language:C
Status:COMPILE ERROR

Compiler report

input/code.c: In function 'main':
input/code.c:15:39: error: expected ';' before 'count'
   15 |                 count[x] += count[x-k]
      |                                       ^
      |                                       ;
   16 |                 count[x] %= N
      |                 ~~~~~                  
input/code.c:20:26: error: expected ';' before '}' token
   20 |     printf("%d",count[n])
      |                          ^
      |                          ;
   21 | }
      | ~                         
input/code.c:7:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%d", &n);
      |     ^~~~~~~~~~~~~~~

Code

#include <stdio.h>

#define N 10**9+7

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

    int count[n+1];
    count[0] = 1;

    for (int x=1; x<n+1; x++) {
        for (int k=1; k<=6; k++) {
            if (x-k >= 0) {
                count[x] += count[x-k]
                count[x] %= N
            }
        }
    }
    printf("%d",count[n])
}