Windy days We know the wind speed measured in N locations across the country for the last D days. Write a program that determines the following: 1. The location where the daily average wind speed was the smallest. How many windy days were in the first location? 2. 3. The list of locations where there was a day with a wind speed of at least 50km/h. Was there any day when there was no wind in the country? If yes, which day? 4. 5. Two locations such that in the first location the wind speed was always bigger or equal to the wind speed in the second one. Input The first line of the standard input contains the number of measurement locations (15NS50), and the number of days (15D550). Afterward, there are N lines, one line for each location. Each line contains D integer numbers- the wind speed measurements for a location, in kilometers per hour (OSW₁, S100). Output The standard output should contain a line with a single # character before the solution of each subtask. This # character line is followed by as many lines as needed for the output of a subtask. If you cannot solve a subtask, you should output only the line containing the # character. If the output format is not correct (less/more # characters are in the output), you will get "Output format error", even if you have correct solutions for some subtasks. Subtask 1 Print the index of the location with the minimum average wind speed. If there are multiple possible answers, give the smallest index. The locations are indexed with num- bers from 1 to N. Subtask 2 Print the count of days when the wind speed was bigger than 0 in the first location. Subtask 3 Print the number of locations where there was a day with at least 50km/h of wind. Afterward, in the same line, list the indexes of these locations in increasing order, separated by spaces. Subtask 4 Print the index of a day on which the wind speed was 0 in every location, or-1 if there was no such day. If there are multiple possible answers, give the smallest index. The days are indexed with numbers from 1 to D. Subtask 5 Print two different numbers, the indexes of two locations. It should be true that every day the wind speed in the first location was not less than the wind speed in the second location. If there are no such locations, print-1-1. If there are multiple solutions, you can give any.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 20PE: When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making...
icon
Related questions
Question

Don't reject the question is complete

Windy days
We know the wind speed measured in N locations across the country for the last D days.
Write a program that determines the following:
1.
The location where the daily average wind speed was the smallest.
How many windy days were in the first location?
2.
3.
The list of locations where there was a day with a wind speed of at least 50km/h.
Was there any day when there was no wind in the country? If yes, which day?
4.
5.
Two locations such that in the first location the wind speed was always bigger or equal to
the wind speed in the second one.
Input
The first line of the standard input contains the number of measurement locations (15NS50), and
the number of days (15D550). Afterward, there are N lines, one line for each location. Each line
contains D integer numbers the wind speed measurements for a location, in kilometers per hour
(0SW,S100).
Output
The standard output should contain a line with a single # character before the solution of each
subtask. This # character line is followed by as many lines as needed for the output of a subtask.
If you cannot solve a subtask, you should output only the line containing the # character. If the
output format is not correct (less/more # characters are in the output), you will get "Output format
error", even if you have correct solutions for some subtasks.
Subtask 1
Print the index of the location with the minimum average wind speed. If
there are multiple possible answers, give the smallest index. The locations are indexed with num-
bers from 1 to N.
Subtask 2
location.
Print the count of days when the wind speed was bigger than 0 in the first
Subtask 3
Print the number of locations where there was a day with at least 50km/h
of wind. Afterward, in the same line, list the indexes of these locations in increasing order, separated
by spaces.
Subtask 4
Print the index of a day on which the wind speed was 0 in every location,
or-1 if there was no such day. If there are multiple possible answers, give the smallest index. The
days are indexed with numbers from 1 to D.
Subtask 5
Print two different numbers, the indexes of two locations. It should be
true that every day the wind speed in the first location was not less than the wind speed in the
second location. If there are no such locations, print-1-1. If there are multiple solutions, you can
give any.
Transcribed Image Text:Windy days We know the wind speed measured in N locations across the country for the last D days. Write a program that determines the following: 1. The location where the daily average wind speed was the smallest. How many windy days were in the first location? 2. 3. The list of locations where there was a day with a wind speed of at least 50km/h. Was there any day when there was no wind in the country? If yes, which day? 4. 5. Two locations such that in the first location the wind speed was always bigger or equal to the wind speed in the second one. Input The first line of the standard input contains the number of measurement locations (15NS50), and the number of days (15D550). Afterward, there are N lines, one line for each location. Each line contains D integer numbers the wind speed measurements for a location, in kilometers per hour (0SW,S100). Output The standard output should contain a line with a single # character before the solution of each subtask. This # character line is followed by as many lines as needed for the output of a subtask. If you cannot solve a subtask, you should output only the line containing the # character. If the output format is not correct (less/more # characters are in the output), you will get "Output format error", even if you have correct solutions for some subtasks. Subtask 1 Print the index of the location with the minimum average wind speed. If there are multiple possible answers, give the smallest index. The locations are indexed with num- bers from 1 to N. Subtask 2 location. Print the count of days when the wind speed was bigger than 0 in the first Subtask 3 Print the number of locations where there was a day with at least 50km/h of wind. Afterward, in the same line, list the indexes of these locations in increasing order, separated by spaces. Subtask 4 Print the index of a day on which the wind speed was 0 in every location, or-1 if there was no such day. If there are multiple possible answers, give the smallest index. The days are indexed with numbers from 1 to D. Subtask 5 Print two different numbers, the indexes of two locations. It should be true that every day the wind speed in the first location was not less than the wind speed in the second location. If there are no such locations, print-1-1. If there are multiple solutions, you can give any.
Example
Input
56
0 6 1 8 0 33
0 50 50 000
14 140 1
2 71 82 8 00
31 41 5 95 03
Limits
Time limit: 1.0 s
Memory limit: 64 MB
Output
+
3
*
4
3245
#
5
F
42
DEL
Transcribed Image Text:Example Input 56 0 6 1 8 0 33 0 50 50 000 14 140 1 2 71 82 8 00 31 41 5 95 03 Limits Time limit: 1.0 s Memory limit: 64 MB Output + 3 * 4 3245 # 5 F 42 DEL
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr