A:签到

#include<iostream> 
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int read()
{
    int x=0,f=1;char c=getchar();
    while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
    while (c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
    return x*f;
}
#define N 1010 
int n,a[N];
int main()
{
    n=read();
    for (int i=1;i<=n;i++) a[i]=read();
    sort(a+1,a+n+1);
    cout<<a[n]-a[1]+1-n;
    return 0;
}
View Code

相关文章:

  • 2022-12-23
  • 2022-02-20
  • 2021-05-30
  • 2021-09-21
  • 2021-06-05
  • 2021-12-16
  • 2021-11-02
  • 2021-07-29
猜你喜欢
  • 2022-02-12
  • 2021-09-18
  • 2021-10-26
  • 2021-12-22
  • 2021-06-02
  • 2021-08-28
  • 2022-12-23
相关资源
相似解决方案