Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
106157 | 包老师 | 22相差2的数的个数 | C++ | Wrong Answer | 0 MS | 268 KB | 404 | 2025-01-15 15:12:34 |
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int a[n]; for (int i = 0; i < n; i++) { cin>>a[i]; } int b[n]; int count,MAX=0; for(int j=0;j<n-1;j++){ count=0; for(int i=j+1;i<n;i++){ if(a[i]-a[j]<=2){ count++; } } if(count>MAX){ MAX=count; } } cout<<MAX; return 0; }
------Input------
10 80 79 78 77 65 55 54 54 50 49
------Answer-----
3
------Your output-----
9