如果你是这要用的for循环
for(int i=1;i<=n;i++) { if(x!=6&&x!=0) { ans+=250; } x++; x=(x)%7; }
在上面加上
if(x==7) x=0;