HPU 1716: Thanksgiving Day KK Session-the test came to the water

Source: Internet
Author: User
Tags first row time limit
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;
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.