不加糖的睿子 2015-11-24 16:12 采纳率: 0%
浏览 1343

(C语言)我只输入了下面第一个代码,然后出现了第二个文件及代码,这是怎么回事_(:з」∠)_求助

#include
#include
int main()
{
const double pi = acos(-1.0);
double r,h,s1,s2,s;
scanf("%lf%lf",&r,&h);
s1 = pi*r*r;
s2 = 2*pi*r*h;
s = s1*2.0 + s2;
printf("Area = %.3f\n",s);
return 0;
}

#include
#include
#include
int leap(int n)
{
int m=1;
while(n!=1)
{
if(n%2==1)
n=n*3+1;
else
n=n/2;
m++;
}
return m;
}
int main(void)
{
int i,j,max=0,x,y;
int a,b;
short count[1000002];
memset(count,0,sizeof(count));
while(scanf("%d%d",&i,&j)!=EOF)
{
a=i;
b=j;
max=0;
if(i<=j)
for(i;i<=j;i++)
{
if(count[i]==0)
{
x=leap(i);
count[i]=x;
}
else
x=count[i];
if(x>max)
{
max=x;
}
}
else
for(j;j<=i;j++)
{
if(count[j]==0)
{
x=leap(j);
count[j]=x;
}
else
x=count[j];
if(x>max)
{
max=x;
}
}
printf("%d %d %d\n",a,b,max);
}
return 0;
}

  • 写回答

3条回答 默认 最新

  • threenewbee 2015-11-24 16:27
    关注

    一个程序只能有一个main函数,如果后面不是你要的,删除好了。

    评论

报告相同问题?

悬赏问题

  • ¥15 一道python难题2
  • ¥15 一道python难题
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题
  • ¥15 教务系统账号被盗号如何追溯设备