/ SeriousOJ /

Record Detail

Compile Error

foo.c:2:11: error: expected declaration specifiers or '...' before string constant
    2 |     scanf("%d", &T);
      |           ^~~~
foo.c:2:17: error: expected declaration specifiers or '...' before '&' token
    2 |     scanf("%d", &T);
      |                 ^
foo.c:4:5: error: expected identifier or '(' before 'while'
    4 |     while (T--) {
      |     ^~~~~

Code

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

    while (T--) {
        long long l, r, x;
        scanf("%lld %lld %lld", &l, &r, &x);
        long long p1 = l + x;
        long long q1 = l - x;

        if (p1 >= l && p1 <= r) {
            printf("%lld %lld\n", p1, l);
        }
        else if (q1 >= l && q1 <= r) {
            printf("%lld %lld\n", l, q1);
        }
        else {
            printf("-1 -1\n");
        }
    }

Information

Submit By
Type
Submission
Problem
P1186 Equal to X
Contest
Brain Booster #9
Language
C99 (GCC 13.2.0)
Submit At
2025-04-06 17:16:25
Judged At
2025-04-06 17:16:25
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes