#include <stdio.h>
int getPrice(int distance,int time) {
float cost;
if (distance <= 3) {
cost = 14;
}
else
{
if (time >= 5 && time < 23) {
cost = (distance - 3) * 2.3 + 14;
}else {
cost = (distance - 3) * 2.3 * 1.2 + 14;
}
}
return cost;
}
int main() {
int distance,time;
float cost;
distance = 12;
time = 9;
float cost1=getPrice(distance, time);
time = 18;
float cost2 = getPrice(distance, time);
cost = cost1 + cost2;
printf("小明每天要花%f元坐车", cost);
return 0;
}