出租车计价:
#include <stdio.h>
int main()
{int x,m,y;double z;scanf("%d",&x);scanf("%d",&m);if(x>0&&x<=3){y=10;}else if((x-3)>0&&(x-3)<=10){y=10+2*(x-3);}else if(x>13){y=3*(x-13)+10+2*10;}else{return 1;}if(m>=5){z=(m/5.0)*2.0;}else{z=0.0;}double fee=y+z; //注意把z、fee写成double类型的 才好四舍五入printf("%.0f",fee);return 0;
}
/*
#include <stdio.h>int countdigit(int num, int digit);int main()
{int n;scanf("%d", &n);int count = assistant(n, 2);printf("%d", count);return 0;
}int digit(int num, int digit)
{int count = 0;if (num == 0 && digit == 0) {return 1; }while (num > 0) {int last = num % 10;if (last == digit) {count++;}num /= 10; }return count;
}
*//*
#include <stdio.h>double real,imag; //全局变量
void prod(double real1,double imag1,double real2,double imag2);
void add(double real1,double imag1,double real2,double imag2);
int main()
{double real1,real2,imag1,imag2;scanf("%lf %lf",&real1,&imag1);scanf("%lf %lf",&real2,&imag2);add(real1,imag1,real2,imag2);printf("%.2f+%.2fi\n",real,imag);prod(real1,imag1,real2,imag2);printf("%.2f+%.2fi\n",real,imag);return 0;
}void prod(double real1,double imag1,double real2,double imag2)
{real=real1*real2-imag1*imag2;imag=real1*imag2+real2*imag1;return;
}
void add(double real1,double imag1,double real2,double imag2)
{real=real1+real2;imag=imag1+imag2;return;
}
*//*
#include <stdio.h>
int main()
{int choice;double cash=0.0;double value;void income(double number,double cash),explend(double number,double cash);scanf("%d",&choice);if(choice!=0){if(choice==1||choice==2){scanf("%lf",&value);if(choice==1){income(value);}else{expend(value);}printf("%.2f",cash);scanf("%d",&choice);}else(choice==0){return 1;}}return 0;} void income(double number,double cash)
{return (cash+=number);
}
void explend(double number,double cash)
{return (cash-=number);
}
*//*
#include <stdio.h>
int main()
{char ch;ch=getchar();while(ch!='\n'){if(ch>='A'&&ch<='Z'){ch=ch-'A'+'a';}else if(ch>='a'&&ch<='z'){ch=ch-'a'+'A';}putchar(ch);ch=getchar();}}return 0;
} #include <stdio.h>
int main()
{char ch;while((ch=getchar())!=EOF){if(ch>='A'&&ch<='Z'){ch=ch-'A'+'a';}else if (ch>='a'&&ch<='z'){ch=ch-'a'+'A';}putchar(ch);}}return 0;
}
*//*
#include <stdio.h>
int main()
{int word,count;char ch;word=count=0;while((ch=getchar())!=EOF){if(ch==' '){word=0;}else if(word==0){word=1;count++;}}printf("%d",count);return 0;
}*/#include <stdio.h>
#include <math.h>double distance(double x1,double x2,double y1,double y2)
{double dist;dist = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));return dist;
}int main()
{double x1,y1,x2,y2;scanf("%lf %lf",&x1,&y1);scanf("%lf %lf",&x2,&y2);double dist=distance(x1,x2,y1,y2);printf("%.2f",dist);return 0;
}