杭电2001.为什么是wrong answer?#include#includemain(){float x1,x2,y1,y2;while(scanf("%f %f %f %f",&x1,&x2,&y1,&y2)!=EOF){printf("%.2f",sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));putchar('\n');}}
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 05:32:11
xݑN@_1BGo xK-hI5H%X#"0hP#H aHwK¥D=lfvf;;/CM~nʩv/*B۳0\4Y~a9L&fIR I"Ip.HXٰΆ6&66/\luX=bI\B86=Izxb¾IO:\sq)l`b۔ago)UyJOy v=(UF]BUN`3 BMJΪ}['(w`.sϣzSk(o$YKWoTeTG
Z9 תW(ph U
杭电2001.为什么是wrong answer?#include#includemain(){float x1,x2,y1,y2;while(scanf("%f %f %f %f",&x1,&x2,&y1,&y2)!=EOF){printf("%.2f",sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));putchar('\n');}}
杭电2001.为什么是wrong answer?
#include
#include
main()
{
float x1,x2,y1,y2;
while(scanf("%f %f %f %f",&x1,&x2,&y1,&y2)!=EOF)
{
printf("%.2f",sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
putchar('\n');
}
}
杭电2001.为什么是wrong answer?#include#includemain(){float x1,x2,y1,y2;while(scanf("%f %f %f %f",&x1,&x2,&y1,&y2)!=EOF){printf("%.2f",sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));putchar('\n');}}
题目要求是“输入数据有多组,每组占一行,由4个实数组成,分别表示x1,y1,x2,y2,数据之间用空格隔开”,你把输入的顺序弄错了scanf("%f %f %f %f",&x1,&x2,&y1,&y2)