1716: Thanksgiving KK-The exam is comingTime limit: 1 Sec memory limit: MB
Submissions: 480 Resolution: 116
Submitted State [Discussion Version]
Title Description
A lot of lessons are coming soon, and it's a horrible test. Now KK seniors are about to usher in the N test, in order not to hang the branch, he must review the N-door course. But KK Seniors are more playful, a day will only spend a time and B energy to review. Know the distance test and D days, ask KK Seniors can review all the lessons. input
Given an integer t, indicates that there is a T (t<=50) Group of test data. The first row of each set of test data has an integer n (1<=n<=100) that represents the number of courses. The next line has three integers a,b,d (0<=a,b,d<=1000), representing the information mentioned above. There are n lines below, each line has two integers t[i],e[i] (0<=t[i],e[i]<=1000), indicating that KK Seniors review the course of the first I, takes time t[i], consumes the energy e[i]. Output
If KK Seniors can review all the courses, output Yes, otherwise output No. The output takes up one row. Sample Input
1
5
2 3 4
1 1
1 1
1 1
1 1 1
1
Sample Output
YES
Tips
Source
Kk
Ac-code:
#include <cstdio>
int main ()
{
int t,n,a,b,d,e,c,i;
scanf ("%d", &c);
while (c--)
{
scanf ("%d", &n);
scanf ("%d%d%d", &a,&b,&d);
A*=d;
B*=d;
for (i=0;i<n;i++)
{
scanf ("%d%d", &t,&e);
a-=t;
b-=e;
}
if (a>=0&&b>=0)
printf ("yes\n");
else
printf ("no\n");
}
return 0;
}