我在try 代码力问题1921-C.问题是,当我把一个单一的测试用例,它的工作很好,但如果我把所有的测试用例在一起,结果的变化.
对于测试用例
12 621526648 2585904 3566299
51789 61859 71998 73401 247675 298086 606959 663464 735972 806043 806459 919683
输出应该是"是",但当包括这个在内的多个输入一起给出时,它会显示"否".
我的代码是
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int test = sc.nextInt();
for (int t_ = 0; t_ < test; t_++) {
long n = sc.nextLong();
long f = sc.nextLong();
long a = sc.nextLong();
long b = sc.nextLong();
long now = 0L;
for (int i = 0; i < n; i++){
long m = sc.nextLong();
long min = Math.min(a*(m - now), b);
f = f - min;
if(f <= 0) {
System.out.println("No");
break;
}
now = m;
}
if(f > 0) {
System.out.println("Yes");
}
}
}
}