杭电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/12/19 04:40:50
杭电2001.为什么是wronganswer?#include#includemain(){floatx1,x2,y1,y2;while(scanf("%f%f%f%f",&x1,&x2,&y1,&y

杭电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)