1 条题解

  • 0
    @ 2026-3-8 14:19:19
    #include<bits/stdc++.h>
    using namespace std;
    int n,c;
    int ans=0;
    int main(){
    	scanf("%d%d",&n,&c);
    	int pre=-c;
    	for(int i=1;i<=n;i++){
    		int x;
    		scanf("%d",&x);
    		if(x-pre>=c)
    			pre=x,ans++;
    	}
    	printf("%d",ans);
    	return 0;
    }
    
    • 1

    信息

    ID
    7915
    时间
    2000ms
    内存
    1024MiB
    难度
    1
    标签
    递交数
    41
    已通过
    34
    上传者