234C. Weather
C. Weather:题目
为什么直接交代码不行啊,非要加两句话,有没有大佬说说?
#include <bits/stdc++.h>
using namespace std;
// typedef long long ll;
vector<int> a((int)3e5);
vector<int> b((int)3e5), c((int)3e5);
int main()
{freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);int n;cin >> n;if (n==2) {int cou = 0,x;cin>>x;if (x>=0) cou++;cin>>x;if (x<=0) cou++;cout<<cou<<endl;return 0;}b[0] = c[n + 1] = 0;for (int i = 1; i <= n; i++){cin >> a[i];}for (int i = 1; i <= n; i++){b[i] = b[i - 1];if (a[i] >= 0)b[i]++;}for (int i = n; i >= 1; i--){c[i] = c[i + 1];if (a[i] <= 0)c[i]++;}int res = (int)2e5;for (int i = 2; i <= n-1; i++){if (a[i] != 0)res = min(res, b[i - 1] + c[i + 1]);elseres = min(res, b[i - 1] + c[i + 1] + 1);}cout << res << endl;
}
2022年2月27日,1:38,还有一题1300结束
234C. Weather相关推荐
- weather_在Weather App中使用Android Location API –搜索城市
weather 在这篇文章中,我想描述如何使用openweathermap搜索城市以获取天气状况. 我们可以通过两种方式查找城市: 使用名称模式 使用地理坐标(Android Location API ...
- Indicator Weather 13.06 发布 增加 Kelvin 支持
Indicator Weather 是一个天气工具,可以在桌面上查看到天气信息.新版中增加了 Kelvin 温度单位.可以在 Indicator Weather appindicator-->P ...
- [Alfred]为Baidu Weather Workflow更新图标
Alfred workflow:百度天气,修改更新图标显示: 下载:https://github.com/BobSte/weather-workflow 原始代码是php脚本,为其增加了一个取图片的函 ...
- wether.html5.qq.com,weather.html
weather if(!location.search){location.search = '?province=重庆市&city=重庆市&county=渝北区';} functio ...
- 使用Google Weather API查询天气预报
Google Weather API 只支持美国地区使用邮政编码进行查询,例如: http://www.google.com/ig/api?hl=zh-cn&weather=94043 (94 ...
- php 抓取天气情况 www.weather.com.cn
<?phpprint_r(getweather(101120501));/*** Server 天气情况获取函数* @param unknown $city*/ function getweat ...
- python 爬取http://www.weather.com.cn/中国主要城市周边城市的天气
编程实现自动爬取中国气象网站 http://www.weather.com.cn/气象数据,将中国主要城市 (北京 .上海 .广州 .杭州 .武汉 .南京 .深圳 .苏州 .厦门 .合肥 和成都 ) ...
- Autonomous Driving in Adverse Weather Conditions: A Survey - 恶劣天气条件下的自动驾驶:一项调查 (arXiv 2021)
Autonomous Driving in Adverse Weather Conditions: A Survey - 恶劣天气条件下的自动驾驶:一项调查(arXiv 2021) 摘要 1. 引言 ...
- Improved 3D Object Detector Under Snowfall Weather Condition Based on LiDAR Point Cloud
Improved 3D Object Detector Under Snowfall Weather Condition Based on LiDAR Point Cloud Method Doubl ...
最新文章
- python——def自定义函数的应用
- tensorflow全联接层fully_connected参数解释正确的
- 数组公式基本功修炼之初步使用
- 学python最好的方式-最好的Python入门教程是?
- 判断一棵二叉树是否为搜索二叉树、完全二叉树、平衡二叉树(java)
- 普华基础软件笔试_普华“2018上海市软件和集成电路产业发展专项资金项目”成功验收...
- 马云卸任阿里巴巴集团董事:传承计划执行完毕,换个江湖见!
- (转,记录用)jQuery页面加载初始化的3种方法
- springboot属性注入转化为对象
- P问题、NP问题和NPC问题
- 尚学堂马士兵servlet/JSP笔记(四、JSP)
- jwplayer.v7.1.4视频播放器的使用
- 从烂漫少女到已为人母:八年青春 梦断互联网
- Chrome 68 运行后整个浏览器窗口变黄/粉色问题修正方法
- 腾讯面试总结——iOS开发
- 用指针写藏头诗c语言,智能藏头诗小程序:小程序可以自动写诗啦!为“Ta”写首诗表白~...
- Java开发:哪些技能测试来评估Java开发人员的技能?
- win10如何修改远程桌面的默认端口_win10远程桌面端口的更改办法
- poj3253切割木板(哈夫曼树) 贪心【优先队列】
- 盒子移动的问题,拖拽问题
热门文章
- 深入浅出.NET泛型编程(1)
- 同方专转本计算机视频,同方2011专转本计算机
- python json dict对象使用_Python中:dict(或对象)与json之间的互相转化
- springboot redis shiro 实现 单点登录
- springmvc限流解决方案
- Python爬虫自学之第(零)篇——爬虫思路和request模块使用
- 基于token与基于服务器的身份认证
- Android 使用ViewPager实现导航页面
- 在windows 2003系统安装oracle11G出现的问题
- greenplum gpfdist应用