| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 69146 | 冯诚阳 | 22相差2的数的个数 | C++ | Wrong Answer | 1 MS | 272 KB | 381 | 2024-03-30 17:11:34 |
#include<iostream> #include<cmath> using namespace std; int main(){ int n,s=0,t; cin>>n; int a[n]; for(int i=0;i<n;i++) cin>>a[i]; for(int i=0;i<n;i++){ t=0; for(int j=0;j<n;j++){ if(abs(a[i]-a[j])<=2) t++; } if (t-1>s) s=t-1; } cout<<s; return 0; }
------Input------
10 80 79 78 77 65 55 54 54 53 49
------Answer-----
4
------Your output-----
3