枚举一个点,假设它一定符合条件,据此珂以\(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. log4j.properties 输出指定类日志

    比如,我只要众多日志中,红色框的日志,则可以指定类:com.dangdang.ddframe.rdb.sharding.parser.SQLParserFactory 修改配置文件: 再次输出结果为:

  2. 阶段1 语言基础+高级_1-3-Java语言高级_1-常用API_1_第8节 Math类_19_Math练习:小学数学真题

    题目 画数轴 解题思路 强转成int类型就会舍弃小数位数 输出最终的数量 如果用Math.ceil的方式的话

  3. 阶段1 语言基础+高级_1-3-Java语言高级_04-集合_08 Map集合_6_Map集合遍历键值对方式

    增强for

  4. linux查找所有文件中某个字符串

    查找目录下的所有文件中是否含有某个字符串 find .|xargs grep -ri "IBM" 查找目录下的所有文件中是否含有某个字符串,并且只打印出文件名 find .|xar ...

  5. Mbox-React Native

    Mbox-React Native 学习网址:https://www.jianshu.com/p/bbf9837443f3 MboX环境配置: .npm i mobx mobx-react --sav ...

  6. chapter2

    Chapter2 Tip1 静态工厂方法代替构造器 公有的静态方法,只是一个返回类实例的静态方法. 静态工厂方法的优势: 优势一: 有名称,如果构造器本身没有正确的描述被返回的对象,具有适当名称的静态 ...

  7. spring boot 将对象转换为json返回

    Spring Boot默认使用Jackson将对象转换为json,需要配置以下依赖: compile group: 'com.fasterxml.jackson.core', name: 'jacks ...

  8. 大牛总结的 Git 使用技巧,写得太好了!

    作者:你喜欢吃青椒么 juejin.im/post/5d157bf3f265da1bcc1954e6 前言 本文是参考廖雪峰老师的Git资料再加上我自己对Git的理解,记录我的Git学习历程,作下此文 ...

  9. 《剑指offer》面试题19 二叉树的镜像 Java版

    书中方法:这道题目可能拿到手没有思路,我们可以在纸上画出简单的二叉树来找到规律.最后我们发现,镜像的实质是对于二叉树的所有节点,交换其左右子节点.搞清楚获得镜像的方法,这道题实际上就变成了一道二叉树遍 ...

  10. hdu 3333 离线线段树 + 思维/树状数组 /在线主席树

    #include<iostream> #include<cstdio> #include<string> #include<cmath> #includ ...