Challenge Day The Day of Challenge is one of the favorite social sport events of people since 1991. In Hungary, 1591 settlements have taken part in the challenge so far. Last year, the populations of the villages and towns taking part did 48 million minutes of sport during a single day. To apply for the challenge, the name of the settlement, the population, and the number of people willing to take part is needed. When processing the data, the settlements are categorized accord- ing to this: I. category: less than 700 people as population; II. category: 700-1499 people; III. cat- egory: 1500-2999 people; IV. category: 3000-7999 people; V. category: 8000-24999 people; VI. category: 25000-69999 people; VII. category: more than 70000 people. Write a program that gives at which registration the sum of participants reached (or went over) the expected 10000 people. Input The first line of the standard input contains the count of settlements (1N<1000) who applied for the challenge. The next N lines contain the data about a settlement each: the name of the settlement, the population (1SP<2000 000) and the count of those taking part (1

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

c++

Challenge Day
The Day of Challenge is one of the favorite social sport events of people since 1991. In Hungary,
1591 settlements have taken part in the challenge so far. Last year, the populations of the villages
and towns taking part did 48 million minutes of sport during a single day.
To apply for the challenge, the name of the settlement, the population, and the number of people
willing to take part is needed. When processing the data, the settlements are categorized accord-
ing to this: I. category: less than 700 people as population; II. category: 700-1499 people; III. cat-
egory: 1500-2999 people; IV. category: 3000-7999 people; V. category: 8000-24999 people; VI.
category: 25000-69999 people; VII. category: more than 70000 people.
Write a program that gives at which registration the sum of participants reached (or went over)
the expected 10000 people.
Input
The first line of the standard input contains the count of settlements (1<N<1000) who
applied for the challenge. The next N lines contain the data about a settlement each: the name of
the settlement, the population (1<P<2000 000) and the count of those taking part
(1SRS200 000).
Output
The first line of the standard output should contain the index of the first registration at
which the sum of participants reached (or went over) the expected 10000 people. If the sum of
participants was less than 10000, the output should be -1.
Example
Input
Output
4
-1
Miskolc
166823
1234
Aszód
5772
234
Zirc
7454
333
Bóly
3939
282
Limits
Time limit: 0.1 second
Memory limit: 32 MB
Transcribed Image Text:Challenge Day The Day of Challenge is one of the favorite social sport events of people since 1991. In Hungary, 1591 settlements have taken part in the challenge so far. Last year, the populations of the villages and towns taking part did 48 million minutes of sport during a single day. To apply for the challenge, the name of the settlement, the population, and the number of people willing to take part is needed. When processing the data, the settlements are categorized accord- ing to this: I. category: less than 700 people as population; II. category: 700-1499 people; III. cat- egory: 1500-2999 people; IV. category: 3000-7999 people; V. category: 8000-24999 people; VI. category: 25000-69999 people; VII. category: more than 70000 people. Write a program that gives at which registration the sum of participants reached (or went over) the expected 10000 people. Input The first line of the standard input contains the count of settlements (1<N<1000) who applied for the challenge. The next N lines contain the data about a settlement each: the name of the settlement, the population (1<P<2000 000) and the count of those taking part (1SRS200 000). Output The first line of the standard output should contain the index of the first registration at which the sum of participants reached (or went over) the expected 10000 people. If the sum of participants was less than 10000, the output should be -1. Example Input Output 4 -1 Miskolc 166823 1234 Aszód 5772 234 Zirc 7454 333 Bóly 3939 282 Limits Time limit: 0.1 second Memory limit: 32 MB
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY