/ SeriousOJ /

Record Detail

Compile Error

foo.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.

Code

#include <iostream>
using namespace std;

int countPairs(int N) {
    int count = 0;
    for (int i = 1; i <= N / 2; ++i) {  // Only iterate up to N/2 to avoid double counting
        int j = N - i;
        if (i < j && j < N) {  // Ensure 0 < i < j < N
            count++;
        }
    }
    return count;
}

int main() {
    int T;
    cin >> T;
    while (T--) {
        int N;
        cin >> N;
        cout << countPairs(N) << endl;
    }
    return 0;
}

Information

Submit By
Type
Pretest
Problem
P1073 Pair Sum
Language
C99 (GCC 13.2.0)
Submit At
2024-08-16 15:43:29
Judged At
2024-08-16 15:43:29
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes