Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
131974 周荣浩 22相差2的数的个数 C++ Wrong Answer 1 MS 268 KB 350 2025-10-02 15:14:13

Tests(0/2):


Code:

#include<bits/stdc++.h> using namespace std; long long a[1000001]; int main(){ int n,max=0,m,start; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } m=1; for(int i=1;i<=n;i++){ for(int j=i+1;j<=n;j++){ if(a[i]-a[j]<=2){ m++; if(m>max) max=m; } else{ break; } } } cout<<max<<endl; return 0; }


Run Info:

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