当前位置: 首页 > news >正文

企业网站建设费用 珠海绿色农产品网站

企业网站建设费用 珠海,绿色农产品网站,科技公司网站制作公司,深圳专业网站设计专业定制✅作者简介#xff1a;人工智能专业本科在读#xff0c;喜欢计算机与编程#xff0c;写博客记录自己的学习历程。 #x1f34e;个人主页#xff1a;小嗷犬的个人主页 #x1f34a;个人网站#xff1a;小嗷犬的技术小站 #x1f96d;个人信条#xff1a;为天地立心人工智能专业本科在读喜欢计算机与编程写博客记录自己的学习历程。 个人主页小嗷犬的个人主页 个人网站小嗷犬的技术小站 个人信条为天地立心为生民立命为往圣继绝学为万世开太平。 本文目录TitleTime LimitMemory LimitProblem DescriptionInputOutputSample InputSample OnputNoteSourceSolutionTitle CodeForces 1804 D. Accommodation Time Limit 2 seconds Memory Limit 512 megabytes Problem Description Annie is an amateur photographer. She likes to take pictures of giant residential buildings at night. She just took a picture of a huge rectangular building that can be seen as a table of n×mn \times mn×m windows. That means that the building has nnn floors and each floor has exactly mmm windows. Each window is either dark or bright, meaning there is light turned on in the room behind it. Annies knows that each apartment in this building is either one-bedroom or two-bedroom. Each one-bedroom apartment has exactly one window representing it on the picture, and each two-bedroom apartment has exactly two consecutive windows on the same floor. Moreover, the value of mmm is guaranteed to be divisible by 444 and it is known that each floor has exactly m4\frac{m}{4}4m​ two-bedroom apartments and exactly m2\frac{m}{2}2m​ one-bedroom apartments. The actual layout of apartments is unknown and can be different for each floor. Annie considers an apartment to be occupied if at least one of its windows is bright. She now wonders, what are the minimum and maximum possible number of occupied apartments if judged by the given picture? Formally, for each of the floors, she comes up with some particular apartments layout with exactly m4\frac{m}{4}4m​ two-bedroom apartments (two consecutive windows) and m2\frac{m}{2}2m​ one-bedroom apartments (single window). She then counts the total number of apartments that have at least one bright window. What is the minimum and maximum possible number she can get? Input The first line of the input contains two positive integers nnn and mmm (1≤n⋅m≤5⋅1051 \leq n \cdot m \leq 5 \cdot 10^51≤n⋅m≤5⋅105) — the number of floors in the building and the number of windows per floor, respectively. It is guaranteed that mmm is divisible by 444. Then follow nnn lines containing mmm characters each. The jjj-th character of the iii-th line is “0” if the jjj-th window on the iii-th floor is dark, and is “1” if this window is bright. Output Print two integers, the minimum possible number of occupied apartments and the maximum possible number of occupied apartments, assuming each floor can have an individual layout of m4\frac{m}{4}4m​ two-bedroom and m2\frac{m}{2}2m​ one-bedroom apartments. Sample Input 5 4 0100 1100 0110 1010 1011Sample Onput 7 10Note In the first example, each floor consists of one two-bedroom apartment and two one-bedroom apartments. The following apartment layout achieves the minimum possible number of occupied apartments equal to 777. |0 1|0|0| |1 1|0|0| |0|1 1|0| |1|0 1|0| |1|0|1 1|The following apartment layout achieves the maximum possible number of occupied apartments equal to 101010. |0 1|0|0| |1|1 0|0| |0 1|1|0| |1|0 1|0| |1 0|1|1|Source CodeForces 1804 D. Accommodation Solution n, m map(int, input().split()) smin smax 0for i in range(n):s input()two j 0# 将连续两盏灯都先视为两居室while j m - 1:if s[j] 1 and s[j 1] 1:j 1two 1j 1two min(two, m // 4) # 两居室的数量不能超过总窗户数的四分之一smin s.count(1) - twotwo j 0# 统计可能的不开灯的两居室和只开一盏灯的两居室数量while j m - 1:if s[j] ! 1 or s[j 1] ! 1:j 1two 1j 1two min(two, m // 4) # 两居室的数量不能超过总窗户数的四分之一smax s.count(1) - (m // 4 - two) # (m // 4 - two) 为开两盏灯的两居室数量 print(smin, smax)
http://www.w-s-a.com/news/350920/

相关文章:

  • wordpress建的大型网站柳州市网站建设
  • 石家庄做网站的公司有哪些微信自媒体网站建设
  • 池州哪里有做网站注册公司有哪些风险
  • 做古代风格头像的网站对网站政务建设的建议
  • 网站搜索栏怎么做设计个网站要多少钱
  • 阿里巴巴网站建设目标wamp wordpress
  • 自己做的网站怎么挂网上金蝶erp
  • 网站的页面由什么组成淘宝网网站建设的需求分析
  • 软文网站推广法dede5.7内核qq个性门户网站源码
  • 个人备案网站名称校园网站建设特色
  • vr超市门户网站建设班级网站怎么做ppt模板
  • 网站建设一般是用哪个软件刚开始做写手上什么网站
  • 用jsp做的网站源代码下载有哪些做红色旅游景点的网站
  • 网站开发的技术选型黄石市网站建设
  • 做直播网站需要证书吗专做宝宝的用品网站
  • 网站标题用什么符号网站制作交易流程
  • dede模板网站教程jsp网站搭建
  • 上海网站开发外包公司鲜花导购网页制作
  • 宿州外贸网站建设公司个人注册网站一般做什么
  • 小公司做网站用哪种服务器什么是网站代理
  • 青岛李村网站设计公司cms建站平台
  • 做saas网站可行吗许昌抖音推广公司
  • 网站建设找谁做seo基础知识培训
  • 微网站怎么做的好建设网站不会写代码
  • 广州外贸网站制作wordpress信息搜索插件
  • 福建高端网站建设个人公众号怎么制作教程
  • 企业网站有哪些举几个例子wordpress ie兼容插件
  • 高端的深圳网站页面设计福清市建设局官方网站
  • 安装网站到服务器合肥建设干部学校网站
  • 影视网站如何做销售案例网站