Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
124199 徐浩天 22相差2的数的个数 C++ Compile Error 0 MS 0 KB 395 2025-07-11 10:41:49

Tests(0/0):


Code:

int f[105]; int n; int main() { cin >> n; for (int i = 0; i < n; i++) { int num; cin >> num; f[num]++; } int maxn = 0; for (int i = 0; i <= 98; i++) { int c = f[i] + f[i + 1] + f[i + 2]; maxn = max(maxn, c); } maxn = max(maxn, f[99] + f[100]); maxn = max(maxn, f[100]); cout << maxn << endl;


Run Info:

Main.cc: In function 'int main()':
Main.cc:5:4: error: 'cin' was not declared in this scope
    cin >> n; 
    ^
Main.cc:14:26: error: 'max' was not declared in this scope
        maxn = max(maxn, c);  
                          ^
Main.cc:16:35: error: 'max' was not declared in this scope
    maxn = max(maxn, f[99] + f[100]);  
                                   ^
Main.cc:18:4: error: 'cout' was not declared in this scope
    cout << maxn << endl; 
    ^
Main.cc:18:20: error: 'endl' was not declared in this scope
    cout << maxn << endl; 
                    ^
Main.cc:18:24: error: expected '}' at end of input
    cout << maxn << endl; 
                        ^