游客 Signup | Login
中文 | En

1713 - 初级第七课——的士收费

某市的士费起步价8元,可以行使3公里。3公里以后,按每公里1.6元计算,输入的士的公里数,请你计算顾客需付费多少元?

Input

公里数

Output

的士费,要求保留小数点后两位小数

Examples

Input

20

Output

35.20yuan

Solution C

#include <stdio.h>
#include <stdlib.h>

int main()
{

    float a,b;
    scanf("%f",&a);
    if(a<=3)
        printf("8.00yuan");
    if(a>3)
    {
        b=8+(a-3)*1.6;
        printf("%.2fyuan",b);
    }

}

Solution C++

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	double dist,fee;
	cin>>dist;
	if (dist<3.0) fee=8;
	else fee=1.6*(dist-3)+8;
	printf("%.2lfyuan\n",fee);
	return 0;
}
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题