网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
10月01日漏签0天
程序设计吧 关注:51,895贴子:140,688
  • 看贴

  • 图片

  • 吧主推荐

  • 游戏

  • 1回复贴,共1页
<<返回程序设计吧
>0< 加载中...

救命啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊

  • 只看楼主
  • 收藏

  • 回复
  • 冰冷的岩浆00
  • 四方游侠
    5
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
Scientists say a lot about the problems of global warming and cooling of the Earth. Indeed, such natural phenomena strongly influence all life on our planet. Our hero Vasya is quite concerned about the problems. He decided to try a little experiment and observe how outside daily temperature changes. He hung out a thermometer on the balcony every morning and recorded the temperature. He had been measuring the temperature for the last n days. Thus, he got a sequence of numbers t1,t2,...,tn, where the i-th number is the temperature on the i-th day. Vasya analyzed the temperature statistics in other cities, and came to the conclusion that the city has no environmental problems, if first the temperature outside is negative for some non-zero number of days, and then the temperature is positive for some non-zero number of days. More formally, there must be a positive integer k (1≤k≤n-1) such that t1<0,t2<0,...,tk<0 and tk+1>0,tk+2>0,...,tn>0. In particular, the temperature should never be zero. If this condition is not met, Vasya decides that his city has environmental problems, and gets upset. You do not want to upset Vasya. Therefore, you want to select multiple values of temperature and modify them to satisfy Vasya's condition. You need to know what the least number of temperature values needs to be changed for that.
Input The first line contains a single integer n (2≤n≤105) the number of days for which Vasya has been measuring the temperature. The second line contains a sequence of n integers t1,t2,...,tn (|ti|≤109) the sequence of temperature values. Numbers ti are separated by single spaces.
Output Print a single integer the answer to the given task.
Sample Input 4
-1 1 -2 1
5
0 -1 1 2 -5
Sample Output 1
2



  • 冰冷的岩浆00
  • 四方游侠
    5
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
??????????????????????????????


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 1回复贴,共1页
<<返回程序设计吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示