Flooded!
| Time Limit: 1000MS | Memory Limit: 30000K | |||
| Total Submissions: 5955 | Accepted: 1800 | Special Judge | ||
Description
From weather data archives, we know the typical volume of water that collects in a region. As prospective homebuyers, we wish to know the elevation of the water after it has collected in low-lying squares, and also the percentage of the region's area that is completely submerged (that is, the percentage of 10-meter squares whose elevation is strictly less than the water level). You are to write the program that provides these results.
Input
Output
Sample Input
3 3
25 37 45
51 12 34
94 83 27
10000
0 0
Sample Output
Region 1
Water level is 46.67 meters.
66.67 percent of the region is under water.
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<fstream>
using namespace std;
#define LEN 1000 int main (void)
{
int n,m,start,maxn,num,sum,i;
int region[LEN];
double water,remain;
num=;
while(cin>>n>>m&&(n||m)){
for(i=;i<n*m;i++)
cin>>region[i];
cin>>maxn;
sort(region,region+n*m);
start=region[];
sum=;
for(i=;i<n*m;i++)
if(sum+(region[i]-start)*i*<=maxn){
sum+=(region[i]-start)*i*;
start=region[i];
}
else
break;
remain=maxn-sum;
water=region[i-]+remain/(double(i)*100.0);
for(i=;region[i]<water&&i<n*m;i++);
printf("Region %d\n",num++);
printf("Water level is %.2f meters.\n",water);
printf("%.2f percent of the region is under water.\n\n",*i/double(n*m));
}
return ;
}
Flooded!的更多相关文章
- [刷题]算法竞赛入门经典(第2版) 4-10/UVa815 - Flooded!
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 代码:(Accepted,0 ms) //UVa815 - Flooded! #include<iostream ...
- uvA Flooded!
Description To enable homebuyers to estimate the cost of flood insurance, a real-estate firm provide ...
- UVA 815 Flooded!
题意:来自:https://blog.csdn.net/lecholin/article/details/70186673 思路: ①数组存每个网格的高度,然后排序,做题时想象为上面的柱状图. ②注意 ...
- 【每日一题】Flooded! UVA - 815 模拟阅读格式题
https://cn.vjudge.net/problem/UVA-815 题意:给你一个矩阵,每个格子的数代表一个海拔并且每个格子的面积100平方米.给你整个区域的降水量(立方米),问降水量(米). ...
- 洪水!(Flooded! ACM/ICPC World Final 1999,UVa815)
题目描述:竞赛入门经典的习题4-10 解题思路:1.把各个网格想象成一个数组 2.排序 3.雨水总体积去铺满 //太懒了只写了求海拔 #include <stdio.h> #define ...
- 【习题 4-9 UVA - 815】Flooded!
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 题目很迷啊. 不会出现盆地? 可以理解为一条线. 从左往右高度上升的一座座山. 然后V升的水从最左边的山倒进去. 然后问你最后海拔多 ...
- Flooded! UVA - 815 (sort排序)
错了好多遍,不知道为啥出错,如果有大神发现,请求指点!!! 附错误代码(错的不知道怎么回事): #include<iostream> #include<cstdio> #inc ...
- zoj 3859 DoIt is Being Flooded (MFSet && Flood Fill)
ZOJ :: Problems :: Show Problem 这题开始的时候想不到怎么调整每个grid的实际淹没时间,于是只好找了下watashi的题解,发现这个操作还是挺简单的. ZOJ3354 ...
- Linux中SysRq的使用(魔术键)
转:http://www.chinaunix.net/old_jh/4/902287.html 魔术键:Linux Magic System Request Key Hacks 当Linux 系统不能 ...
随机推荐
- jquery css属性练习
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- HTML5标签与HTML4标签的区别示例介绍_html5教程技巧
(1)概念的变化: HTML5专注内容与结构,而不专注的表现 <header> <hgroup>导航相关数据</hgroup> </header> &l ...
- LZW压缩算法——简明原理与实现
LZW和哈夫曼编码一样,是无损压缩中的一种.该算法通过建立字典,实现字符重用与编码,适用于source中重复率很高的文本压缩.本文首先讲下LZW的编解码原理,然后给出LZW的实现code. ***** ...
- 轻量的、可自定义 CSS 的 Lightbox 相册插件
jQuery LightGallery是一个轻量级的,可定制的,模块化的,响应式的 jQuery 相册插件.它采用 CSS 来实现图像和视频的大小调整.因此,这将是非常灵活的,并且比使用 JavaSc ...
- SharePoint 2016 图文安装教程
前言 SharePoint 2016如约而至,之前也装过预览版,但是这次是正式版,还是分享一个完整的安装过程给大家,希望能给有需要的人有所帮助. 1.首先安装操作系统,我这里是Windows Serv ...
- GitHub学习心得之 分支操作
目录 前言 1. 一般的push和pull 2. 分支操作 前言 本文对Github的分支操作进行了总结, 主要基于以下文章: http://blog.csdn.net/guang11cheng/ar ...
- spring-boot 热部署 intellij IDE
1.使用springloadded插件: 如何使用: a.先在ide里面部署好你的service,( mvn spring-boot:run) b.修改代码, c.command+F9(或build- ...
- iOS---友盟推送遇到的坑
生产证书无效 很有可能 是你的证书上传的不对 开发证书 对应我们测试环境的推送P12文件 生产证书 对应我们线上环境的推送P12文件 device Token 无效 有可能是你的证书不对 ...
- 【iOS】屏幕适配之NSLayoutConstraint
前言 如何实现一张图片在iPhone和iPad上显示不同的尺寸,我了解到一般有三种办法:直接手写代码动态添加约束:把NSLayoutConstraint关联到ViewController里再viewD ...
- Android中Listview点击item不变颜色以及设置listselector 无效
Android中Listview点击item不变颜色以及设置listselector 无效 这是同一个问题,Listview中点击item是会变颜色的,因为listview设置了默认的listsele ...