额,只是一道签到题,emmm直接代码:
1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 6 const int maxn = 1005; 7 int c[maxn]; 8 int d[maxn]; 9 10 int main(){ 11 int t; 12 scanf("%d", &t); 13 while (t--){ 14 int n, m; 15 scanf("%d %d", &n, &m); 16 for (int i = 0; i < n; i++){ 17 scanf("%d", &c[i]); 18 } 19 for (int i = 0; i < n - 1; i++){ 20 scanf("%d", &d[i]); 21 } 22 d[n-1] = 0; 23 int ans = 0; 24 int i; 25 for (i = 0; i < n; i++){ 26 ans = ans + c[i] - m*d[i]; 27 if (ans < 0) 28 break; 29 } 30 if (i == n) 31 printf("Yes\n"); 32 else 33 printf("No\n"); 34 } 35 //system("pause"); 36 return 0; 37 }
时间: 2024-10-27 08:11:14