枚举一个点,假设它一定符合条件,据此珂以\(O(n)\)算出要删去几个点

于是就\(O(n^2)\)解决了,貌似加一个前缀和可以在\(O(n)\)的时间复杂度内解决本问题,但对于这个数据范围来说\(O(n^2)\)戳戳有余

放个代码:

#include <cstdio>
#define ll long long inline ll read(){
ll x = 0; int zf = 1; char ch = ' ';
while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
if (ch == '-') zf = -1, ch = getchar();
while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar(); return x * zf;
} int a[105]; int main(){
int n = read();
for (int i = 1; i <= n; ++i)
a[i] = read();
int ans = 0, cnt;
for (int i = 1; i <= n; ++i){
cnt = 0;
for (int j = i + 1; j <= n; ++j)
if (!a[j])
++cnt;
for (int j = 1; j < i; ++j)
if (a[j])
++cnt;
if (n - cnt > ans)
ans = n - cnt;
}
printf("%d", ans);
return 0;
}

[CF846A]Curriculum Vitae题解的更多相关文章

  1. Resume (Curriculum Vitae)

    The resume (Curriculum Vitae) is a selling tool outlining your skills and experience so an employer ...

  2. 问题 B: Curriculum Vitae

    问题 B: Curriculum Vitae 时间限制: 1 Sec  内存限制: 128 MB提交: 109  解决: 25[提交][状态][讨论版][命题人:acm4302] 题目描述 Hideo ...

  3. 【CF Edu 28 A. Curriculum Vitae】

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  4. google高级搜索

    ext:php program_listing intitle:MythWeb.Program.Listing inurl:preferences.ini “[emule]” intitle:”Ind ...

  5. [BEC][hujiang] Lesson03 Unit1:Working life ---Grammar & Listening & Vocabulary

    3 Working life p8 Grammar Gerund and infinitive(动名词和不定式) 一般而言:        1 动词后面接动名词还是不定式没有特定规则,主要取决于语言习 ...

  6. CV和Resume的区别(转)

    常常有人把CV和Resume混起来称为“简历”,其实精确而言,CV应该是“履历”,Resume才是简历.Resume概述了有关的教育准备和经历,是对经验技能的摘要:curriculum vitae则集 ...

  7. Google Hack搜索技巧

    想了解更多搜索技巧,点击下面网站了解http://exploit-db.com/google-dorks Google Hack的一些整理 这里是google关键字的用法,要设置它为中文,则是 htt ...

  8. PMP模拟考试-2

    1. Increasing resources on the critical path activities may not always shorten the length of the pro ...

  9. 【Educational Codeforces Round28】

    咸鱼选手发现自己很久不做cf了,晚节不保. A.Curriculum Vitae 枚举一下间断点的位置. #include<bits/stdc++.h> using namespace s ...

随机推荐

  1. jmeter之跨线程组共享cookies

    jmeter在一个线程组里,可以把登录接口放在上面,再添加一个cookies管理器元件,这样下一个接口就可以携带登录信息.在不同线程组里其实也可以共享cookies 目录 1.方法 2.应用 1.方法 ...

  2. BIN转换成HEX格式及HEX转换成BIN的两个函数接口

    unsigned char HEX2BYTE(unsigned char hex_ch) { ') { '; } if (hex_ch >= 'a' && hex_ch < ...

  3. Java ——修饰符 包 Bean

    本节重点思维导图 Bean 是一个类,类中所有的属性都是私有化的,所有的属性都有相应的getter/setter方法 对于boolean类型的成员变量来说,它的getter方法是:isXxxx() 详 ...

  4. 【ABAP系列】SAP ABAP ALV合计或者小计 添加自定义文本

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[MM系列]SAP ABAP ALV合计或者小计 ...

  5. Linux QQ全新回归

    福音! 2019年10月24日,腾讯官方发布QQ Linux 2.0.0 Beta版本,告示着Linux QQ的回归. 2008年,腾讯曾推出QQ for Linux,但2009年之后就再没有更新过, ...

  6. OuterXml和InnerXml(2)

    官方例子:https://msdn.microsoft.com/en-us/library/system.xml.xmlnode.outerxml.aspx using System; using S ...

  7. oracle--表分区、分区索引

    --|/ range分区 create table sale( product_id varchar2(5), sale_count number(10,2) ) partition by range ...

  8. C# DataSet转JSON

    经常会遇到系统数据交互采用JSON数据格式进行交互的,避免不必要的重复工作,记录下自己的处理方式. 获取数据集之后,通过函数对数据集信息进行整理通过.Net Framework3.5提出的JavaSc ...

  9. package.json说明

    package.json是什么? 直接的说:就是管理你本地安装的npm包 一个package.json文件可以做如下事情: 展示项目所依赖的npm包 允许你指定一个包的版本[范围] 让你建立起稳定,意 ...

  10. Codeforces 191C (LCA+树上差分算法)

    题面 传送门 题目大意: 给出一棵树,再给出k条树上的简单路径,求每条边被不同的路径覆盖了多少次 分析 解决这个问题的经典做法是树上差分算法 它的思想是把"区间"修改转化为左右端点 ...