Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
97345 Kevin 22相差2的数的个数 C++ Wrong Answer 1 MS 272 KB 325 2024-11-14 15:27:23

Tests(1/2):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int a[105],n,max=0,jishu; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<=n;i++){ jishu=0; for(int j=1;j<=n;j++){ if((fabs(a[i]-a[j])<=2)&&(i!=j)){ jishu++; } } if(jishu>max) max=jishu; } cout<<max; return 0; }


Run Info:

------Input------
10 80 79 78 77 65 55 54 54 53 49
------Answer-----
4
------Your output-----
3