编译失败求解释。。。。。。

#include<stdio.h>
#include<math.h>

int main(void)
{
int n, r;
scanf("%d%d", &n, &r);
float point[n][2];
for(int i = 0; i <= n-1; i ++)
scanf("%f%f", &point[i][0], &point[i][1]);

float output = 0;
for(int i = 1; i <= n-1; i ++)
output = sqrt( (point[i][0]-point[i+1][0])*(point[i][0]-point[i+1][0]) + (point[i][1]-point[i+1][1])*(point[i][1]-point[i+1][1]) )+ output;

output = output + sqrt( (point[n-1][0]-point[0][0])*(point[n-1][0]-point[0][0]) + (point[n-1][1]-point[0][1])*(point[n-1][1]-point[0][1]) );

output = output + 2*acos(-1)*r;
printf("%.2f", output);
return 0;
}

TO 半夜一起刷题的某个男人:
不准说我脸黑。。。。。。

2 条评论

  • @ 2015-12-05 03:01:31

    'for' loop initial declarations are only allowed in C99 mode

  • @ 2015-12-05 01:30:28

    ###你的姿势不正确,请按照基本法提交
    #include<stdio.h>
    #include<math.h>
    int main()
    {
    int n, r;
    scanf("%d%d", &n, &r);
    float point[n][2];
    for(int i = 0; i <= n-1; i ++)
    scanf("%f%f", &point[i][0], &point[i][1]);
    float output = 0;
    for(int i = 1; i <= n-1; i ++)
    output = sqrt( (point[i][0]-point[i+1][0])*(point[i][0]-point[i+1][0]) + (point[i][1]-point[i+1][1])*(point[i][1]-point[i+1][1]) )+ output;

    output = output + sqrt( (point[n-1][0]-point[0][0])*(point[n-1][0]-point[0][0]) + (point[n-1][1]-point[0][1])*(point[n-1][1]-point[0][1]) );

    output = output + 2*acos(-1)*r;
    printf("%.2f", output);
    return 0;
    }

  • 1

信息

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