#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;
}
一个程序只能有一个main函数,如果后面不是你要的,删除好了。
"只输入了下面第一个代码,然后出现了第二个文件及代码",什么意思?????你粘贴复制错了吧
意思是你一个文件里面有两个main函数的意思吧。