/ SeriousOJ /

Record Detail

Compile Error

foo.c: In function 'main':
foo.c:15:37: error: expected ',' or ';' before ')' token
   15 |             int X = (N *(N - 1)) / 2);
      |                                     ^

Code

#include <stdio.h>

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

    while (T--) {
        int N;
        scanf("%d", &N);

        if (N == 1) {
            printf("0\n");
        } else {
          
            int X = (N *(N - 1)) / 2);
            
           
            int total = X+(N-1);
            
            printf("%d\n",total);
        }
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1026 LUFA cup 2024
Contest
Brain booster #2
Language
C99 (GCC 13.2.0)
Submit At
2024-03-06 14:53:19
Judged At
2024-11-11 03:41:47
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes