Carbon
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
problem
A program that estimates the amount of CO2 emitted by cars is required.
一个需要估算汽车二氧化碳排放量的程序。
Information: An average petrol car produces 100g of CO2 / km with just a driver + 10g/km for each extra passenger. Cars can be assumed to hold no more than 3 passengers plus the driver so, if more than 4 people need to travel by car, two cars are required.
信息:
一辆普通汽车每公里产生 100 克二氧化碳,而每多一个司机,每多一个乘客,就会产生10克二氧化碳。假定汽车可以容纳不超过3名乘客外加一个司机,所以,如果超过4人需要乘汽车旅行,需要两辆车。
Inputs
number of people Distance in km
Output
Total CO2 produced travelling by car in g
输出:
汽车行驶的距离产生的二氧化碳
Example inputs:
9
1000
360000
The number of passengers provided will always be greater than 0 and less than 13.
乘客的数量大于 0 小于 13.
The distances provided will always be from 0 to 10000.
汽车行驶的距离大于 0 小于 10000.
All outputs must be in the form of integers.
所有输出的数据为整数。
Task
Build a program that calculates the average amount of CO2 in g, that is produced when travelling by car.
任务:
设置一个程序,可以计算出在汽车行驶时所排放的平均二氧化碳的量。(以克为单位)