| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 149951 | 任艺宸 | 22相差2的数的个数 | C++ | Time Limit Exceeded | 1000 MS | 272 KB | 583 | 2026-03-21 11:36:14 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n,a[101]={0},sum=0,max=0; cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; } for(int i=0;i<n;i++){ sum=0; for(int j=i+1;j<n;i++){ if(a[i]-a[j]<=2){ sum++; if(sum>max)max=sum; } } }cout<<max+1; return 0; }