/ SeriousOJ /

Record Detail

Compile Error

foo.c: In function 'main':
foo.c:9:24: error: expected ';' before 'if'
    9 |         scanf("%d", &B)
      |                        ^
      |                        ;
......
   12 |         if (B < 1) {
      |         ~~              

Code

#include <stdio.h>

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

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

        
        if (B < 1) {
            printf("-1\n");
        } else {
            
            int perimeter = B + B - 1 + (int)(B * B + (B - 1) * (B - 1));
            
            
            
            
            printf("%d\n", perimeter);
        }
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1027 Right triangle
Contest
Brain booster #2
Language
C99 (GCC 13.2.0)
Submit At
2024-03-06 16:09:06
Judged At
2024-11-11 03:41:26
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes