30pts求条
查看原帖
30pts求条
819326
Birds_int_he_sky楼主2025/1/17 10:00

记录

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,l,ans=0;
    cin>>n>>l;
    bool f[10010]={};
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        f[x]=true;
    }
    for(int i=1;i<l;i++)
    {
        bool flag=true;
        for(int j=i-1,k=i+1;j>=0&&k<=l;j--,k++)
            if(f[j]!=f[k])
                flag=false;
        ans+=flag;
    }
    cout<<ans;
    return 0;
}
2025/1/17 10:00
加载中...