枚举一个点,假设它一定符合条件,据此珂以\(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. value_counts()函数

    value_counts函数用于统计dataframe或series中不同数或字符串出现的次数 ascending=True时,按升序排列. normalize=True时,可计算出不同字符出现的频率 ...

  2. Binder的Native实现libbinder

    libbinder – Binder的Native实现 出于性能和代码统一性的角度考虑,Binder IPC并不Java和Native环境里各实现一次,而只是分别在不同的执行环境里提供使用的接口.使用 ...

  3. C++笔记(6)——关于OJ的单点测试和多点测试

    单点测试 PAT使用的就是单点测试(LeetCode应该也是单点测试).单点测试中系统会判断每组数据的输出结果是否正确,正确则通过测试并获得这则测试的分值.题目的总得分等于通过的数据的分值之和. 代码 ...

  4. TensorFlow学习笔记6-数值计算基础

    TensorFlow学习笔记6-数值计算 本笔记内容为"数值计算的基础知识".内容主要参考<Deep Learning>中文版. \(X\)表示训练集的矩阵,其大小为m ...

  5. vue登录注册实践

    步骤一 1.安装脚手架:npm install vue-cli -g2.wepack生成html模版:vue init webpack ' 文件名'3.安装axios.js-cookie.elemen ...

  6. [Git] 010 对 [Git 008] 的补充:实现 commit 不计次数

    回顾:[Git] 008 status 与 commit 命令的补充 的 "2.4" [Git 008] 的 "2.4" 使用 git commit --ame ...

  7. VS2017运行emwin模拟机不能运行的解决部分

    宇宙第一开发工具的功能太强大了,今天我们来介绍怎么解决VS2017的C++功能运行emwin模拟机不能运行的解决部分 编译软件:Visual Studio 2017:     emwin模拟机版本:S ...

  8. 接口测试工具——postman

    Postman 之前是作为Chrome 的一个插件,现在要下载应用才能使用. 以下是postman 的界面: 各个功能区的使用如下: 快捷区: 快捷区提供常用的操作入口,包括运行收藏夹的一组测试数据, ...

  9. Django设置允许跨域请求

    方式一: 在中间件中 def process_response(self, request, response): response['Access-Control-Allow-Origin'] = ...

  10. ASP.NET MVC @html帮助类

    原文:https://www.cnblogs.com/caofangsheng/p/10462494.html HTML Helpers是用来创建HTML标签进而创建HTML控件的.HTML Help ...