Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
159074 张蔚林 22相差2的数的个数 C++ Compile Error 0 MS 0 KB 298 2026-08-25 16:05:33

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main() { int n,s[101]={},t,sum=0; cin>>n; for(int i=0;i<n;i++){ cin>>s[i]; } for(int j=0;j<n;j++){ for(int i=0;i<n-1;ij++){ if(s[j]-a[i]<=2){ t++; } if(t>=2){ sum++; } } } cout<<sum; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:11:21: error: 'ij' was not declared in this scope
   for(int i=0;i