Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
837 曾浩森 22相差2的数的个数 C++ Wrong Answer 0 MS 268 KB 358 2023-04-15 14:57:03

Tests(1/2):


Code:

#include<iostream> using namespace std; int main(){ int a,b[100],c=1,d=0; cin>>a; for(int i=0;i<=a-1;i++){ cin>>b[i]; } for(int j=0;j<=a;j++){ for(int i=1;i<=a;i++){ if(b[j]-b[i]==1||b[j]-b[i]==2){ c++; } } if(c>d){ d=c; } c=0; } cout<<d; }


Run Info:

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