| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 69148 | 冯诚阳 | 22相差2的数的个数 | C++ | Wrong Answer | 1 MS | 280 KB | 401 | 2024-03-30 17:13:33 |
#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=i;j<n;j++){ if(abs(a[i]-a[j])<=2) t++; } cout<<t<<endl; if (t>s) s=t; } cout<<s; return 0; }
------Input------
10 80 79 78 77 65 55 54 54 50 49
------Answer-----
3
------Your output-----
3 3 2 1 1 3 2 1 2 1 3