关于if结构的优化问题

#include<stdio.h>
int main()
{
int x;
float y;
float price;
printf("请输入您此次行程的距离\n空格隔开后选择您的乘车方式:1为出租车,2为网约车\n");
scanf("%f %d", &y, &x);
switch (x)
{
case 1:
{
printf("此次出行方式为出租车\n");
printf("此次出行距离%.1f公里\n", y);
if (y > 0 && y <= 3)
{
price = 13;
printf("此次花费:%.1f元\n", price);
}
else if (y > 3 && y <= 10)
{
price = 13 + 2.4 * (y - 3);
printf("此次花费:%.1f元\n", price);
}
else if (y > 10)
{

        price = 13 + 16.8 + 3.6 * (y - 10);
        printf("此次花费:%.1f元\n", price);
    }
    }
    break;
  
   case 2:
{
       printf("此次出行方式为网约车\n");
       printf("此次出行距离%.1f公里\n",y);
    if (y > 0 && y <= 3)
        price = 13;
    printf("此次花费:%.1f元\n", price);
    if (y > 3 && y < 5)
    {
        price = 13 + 2.4 * (y - 3);
        printf("此次花费:%.1f元\n", price);
    }
    else if (y >=5 && y<=10)
    {
        price = 0.85*(13 + 2.4 * (y - 3));
        printf("此次花费:%.1f元\n", price);
    }
    if (y > 10)
        price =0.85*( 13 + 16.8 + 3.6 * (y - 10));
    printf("此次花费:%.1f元\n", price);
    break;
}

}

return 0;
}

#include<stdio.h>
int main()
{
        int x;
        float y;
        float price;
        printf("请输入您此次行程的距离\n空格隔开后选择您的乘车方式:1为出租车,2为网约车\n");
        scanf("%f %d", &y, &x);
        if(x==1)
                printf("此次出行方式为出租车\n");
        else
               printf("此次出行方式为网约车\n");
        printf("此次出行距离%.1f公里\n", y);
        if (y > 0 && y <= 3)
        {
                price = 13;
                printf("此次花费:%.1f元\n", price);
        }
        if (y > 3 && y < 5)
        {
                price = 13 + 2.4 * (y - 3);
                printf("此次花费:%.1f元\n", price);
        }
        if (y >=5 && y<=10&&x==1)
        {
                price = 13 + 2.4 * (y - 3);
                printf("此次花费:%.1f元\n", price);
        }
        if (y >=5 && y<=10&&x==2)
        {
                price = 0.85*(13 + 2.4 * (y - 3));
                printf("此次花费:%.1f元\n", price);
        }
        if (y > 10&&x==1)
        {
                price = 13 + 16.8 + 3.6 * (y - 10);
                printf("此次花费:%.1f元\n", price);
        }
        if (y > 10&&x==2)
        {
                price =0.85*( 13 + 16.8 + 3.6 * (y - 10));
                printf("此次花费:%.1f元\n", price);
        }
        return 0;
}