- 论坛徽章:
- 0
|
#include
#include
int h[1000000]; //保存每个格子的高度值,因不知m和n的范围,故高的比较大
int cmp(const void *a, const void *b)
{
return *((int *)a) - *((int *)b);
}
main()
{
int t,m,n,nn;
double x,hw;
int i;
t=0;
while(1)
{
scanf("%d%d",&n,&m);
if(n==0 && m==0)
break;
t++;
nn=m*n;
for(i=0;i0)
{
for(i=1;i0)
hw+=x/i/100;
printf("Region %d\n",t);
printf("Water level is %.2f meters.\n",hw);
printf("%.2f percent of the region is under water.\n\n",i*100/double(nn));
}
}
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/104733/showart_2129931.html |
|