C 语言,不是 C++。
本蒟蒻对 C 和 C++ 的区别了解很少,见谅
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
typedef long long ll;
const int maxn=2e5+5;
int t;
int n;
ll c;
ll a[maxn];
ll pre[maxn];
ll w(int l,int r)
{
return pre[r]-pre[l-1];
}
bool chk(int pos)
{
if(w(pos,n)<ll(pos)*(pos+1)*c)return 0;
if(pos+1==n)return 1;
return chk(pos+1);
}
int main()
{
scanf("%d",&t);
while(t--)
{
scanf("%d%lld",&n,&c);
for(int i=1;i<=n;i++)
{
scanf("%lld",&a[i]);
pre[i]=pre[i-1]+a[i];
}
puts(chk(1)?"YES":"NO");
}
return 0;
}