两道白痴题,浪费感情,如果不是刚入门,就别做了。
1048,算平均数
//ZOJ 1048
#include<stdio.h>
int main()
{
float temp,sum=0.0;
// freopen("1048.txt","r",stdin);
while(scanf("%f",&temp)!=EOF)
sum += temp;
sum /= 12.0;
printf("$%.2f ",sum);
// fclose(stdin);
return 0;
}
#include<stdio.h>
int main()
{
float temp,sum=0.0;
// freopen("1048.txt","r",stdin);
while(scanf("%f",&temp)!=EOF)
sum += temp;
sum /= 12.0;
printf("$%.2f ",sum);
// fclose(stdin);
return 0;
}
1049,根据坐标算半径然后算半圆面积然后除50看看多少年之后可以被淹。。。
//ZOJ 1049
#include<stdio.h>
#include<math.h>
int main()
{
float x,y,r,area;
int i,t,temp;
// freopen("1049.txt","r",stdin);
scanf("%d",&t);
for(i=1;i<=t;i++)
{
scanf("%f %f",&x,&y);
r = sqrt(x*x+y*y);
area = r*r*3.14159;
temp = area / 100;
printf("Property %d: This property will begin eroding in year %d./n",i,temp+1);
}
printf("END OF OUTPUT./n");
// fclose(stdin);
return 0;
}
#include<stdio.h>
#include<math.h>
int main()
{
float x,y,r,area;
int i,t,temp;
// freopen("1049.txt","r",stdin);
scanf("%d",&t);
for(i=1;i<=t;i++)
{
scanf("%f %f",&x,&y);
r = sqrt(x*x+y*y);
area = r*r*3.14159;
temp = area / 100;
printf("Property %d: This property will begin eroding in year %d./n",i,temp+1);
}
printf("END OF OUTPUT./n");
// fclose(stdin);
return 0;
}