几乎一样的代码,我死活过不了!!

这是我同学的代码:
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#define Pi 3.1415926535
using namespace std;

int n;
double dz[100][2],r,sum=0;

int main(){
scanf("%d%lf",&n,&r);
sum += 2*Pi*r;
scanf("%lf%lf",&dz[0][0],&dz[0][1]);
for(int i=1; i<n; i++){
scanf("%lf%lf",&dz[i][0],&dz[i][1]);
sum += sqrt((dz[i-1][0] - dz[i][0])*(dz[i-1][0] - dz[i][0]) + (dz[i-1][1] - dz[i][1])*(dz[i-1][1] - dz[i][1]));
}
sum += sqrt((dz[0][0] - dz[n-1][0])*(dz[0][0] - dz[n-1][0]) + (dz[0][1] - dz[n-1][1])*(dz[0][1] - dz[n-1][1]));
printf("%.2f",sum);
return 0;
}

这是我的代码:
#include<cstdio>
#include<cmath>
#define pi 3.1415926535
int n;
double R,m,x,y,x1,y1,x2,y2,M=0,N=0,ans;
int main()
{
scanf("%d %lf",&n,&R);
scanf("%lf %lf",&x1,&y1);
x=x1;
y=y1;
for(int i=0;i<n-1;i++)
{
scanf("%lf %lf",&x2,&y2);
N=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
N=sqrt(N);
M=M+N;
x1=x2;
y1=y2;
}
m=sqrt((x2-x)*(x2-x)+(y2-y)*(y2-y));
ans=M+m+2*pi*R;
printf("%.2f\n",ans);
return 0;
}

请问为什么我同学的代码过了,可我怎么也过不了!!!!
为神马啊!!!!!@mrw

1 条评论

  • @ 2015-11-15 15:32:12

    你又不是不知道“几乎”什么意思。。

    别打我。我是今年OI不爆零就万幸的萌新啊

  • 1

信息

ID
1007
难度
5
分类
模拟 点击显示
标签
(无)
递交数
12244
已通过
4327
通过率
35%
被复制
27
上传者