Question: Particulate matters are the biggest contributors to Delhi pollution. The main reason behind the increase in the concentration of PMs include vehicle emission by applying Odd Even concept for all types of vehicles. The vehicles with the odd last digit in the registration number will be allowed on roads on odd dates and those with even last digit will on even dates. Given an integer array a[], contains the last digit of the registration number of N vehicles traveling on date D(a positive integer). The task is to calculate the total fine collected by the traffic police department from the vehicles violating the rules. Note: For violating the rule, vehicles would be fined as X Rs. Example 1: Input: 4-> Value of N (5,2,3,7)-> a[], Elements a[0] to a[N-1], during input each element is separated by a new line 12 -> Value of D, i.e. date 200-> Value of x i.e. fine Output: 600 total fine collected Explanation: Date D=12 means, only an even number of vehicles are allowed. Find will be collected from 5,3 and 7 with an amount of 200 each. Hence, the output = 600.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

 

 

Question: Particulate matters are the biggest contributors to Delhi pollution. The main reason
behind the increase in the concentration of PMs include vehicle emission by applying Odd Even
concept for all types of vehicles. The vehicles with the odd last digit in the registration number
will be allowed on roads on odd dates and those with even last digit will on even dates.
Given an integer array a[], contains the last digit of the registration number of N vehicles
traveling on date D(a positive integer). The task is to calculate the total fine collected by the traffic
police department from the vehicles violating the rules.
Note: For violating the rule, vehicles would be fined as X Rs.
Example 1:
Input:
4-> Value of N
(5,2,3,7) -> a[], Elements a[0] to a[N-1], during input each element is separated by a new line
12 > Value of D, i.e. date
200 > Value of x i.e. fine
Output:
600 total fine collected
Explanation:
Date D=12 means, only an even number of vehicles are allowed.
Find will be collected from 5,3 and 7 with an amount of 200 each.
Hence, the output = 600.
Transcribed Image Text:Question: Particulate matters are the biggest contributors to Delhi pollution. The main reason behind the increase in the concentration of PMs include vehicle emission by applying Odd Even concept for all types of vehicles. The vehicles with the odd last digit in the registration number will be allowed on roads on odd dates and those with even last digit will on even dates. Given an integer array a[], contains the last digit of the registration number of N vehicles traveling on date D(a positive integer). The task is to calculate the total fine collected by the traffic police department from the vehicles violating the rules. Note: For violating the rule, vehicles would be fined as X Rs. Example 1: Input: 4-> Value of N (5,2,3,7) -> a[], Elements a[0] to a[N-1], during input each element is separated by a new line 12 > Value of D, i.e. date 200 > Value of x i.e. fine Output: 600 total fine collected Explanation: Date D=12 means, only an even number of vehicles are allowed. Find will be collected from 5,3 and 7 with an amount of 200 each. Hence, the output = 600.
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Arrays
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education