A. Detective Book

代码:

#include <bits/stdc++.h>
using namespace std; const int maxn = 1e4 + ;
int N;
int a[maxn];
int maxx = ; int main() {
scanf("%d", &N);
for(int i = ; i < N; i ++)
scanf("%d", &a[i]); int ans = ;
for(int i = ; i < N; i ++) {
maxx = max(a[i], maxx);
if(maxx == i + ) ans ++;
} printf("%d\n", ans);
return ;
}

B. Good String

代码:

#include <bits/stdc++.h>
using namespace std; int T, N;
string s; int main() {
scanf("%d", &T);
while(T --) {
scanf("%d", &N);
cin >> s;
int st, en;
if(s[] == '>')
printf("0\n");
else if(s[N - ] == '<')
printf("0\n");
else {
for(int i = ; i < N; i ++) {
if(s[i] == '>') {
st = i;
break;
}
}
for(int i = N - ; i >= ; i --) {
if(s[i] == '<') {
en = i;
break;
}
}
printf("%d\n", min(st, N - - en));
}
}
return ;
}

C. Playlist

优先队列 不是很会 看了题解才知道 555

代码:

#include <bits/stdc++.h>
using namespace std; const int maxn = 3e5 + ;
int N, K;
int sum[maxn];
int maxx = ; struct Node{
long long t;
long long b;
}node[maxn]; bool cmp(const Node &n1, const Node &n2) {
return n1.b > n2.b;
} int main() {
scanf("%d%d", &N, &K);
for(int i = ; i <= N; i ++)
cin >> node[i].t >> node[i].b; long long sum = , ans = ;;
priority_queue<long long, vector<long long>, greater<long long> > q;
sort(node + , node + + N, cmp);
for(int i = ; i <= N; i ++) {
q.push(node[i].t);
sum += node[i].t;
if(q.size() > K) {
sum -= q.top();
q.pop();
}
ans = max(ans, sum * node[i].b);
} cout << ans << endl; return ;
}

D. Minimum Triangulation

代码:

#include <bits/stdc++.h>
using namespace std; int N;
int dp[]; int main() {
dp[] = ;
for(int i = ; i <= ; i ++)
dp[i] = dp[i - ] + (i * (i - )); scanf("%d", &N);
printf("%d\n", dp[N]);
return ;
}

Educational Codeforces Round 62的更多相关文章

  1. Educational Codeforces Round 62 (Rated for Div. 2) C 贪心 + 优先队列 + 反向处理

    https://codeforces.com/contest/1140/problem/C 题意 每首歌有\(t_i\)和\(b_i\)两个值,最多挑选m首歌,使得sum(\(t_i\))*min(\ ...

  2. Educational Codeforces Round 62 E 局部dp + 定义状态取消后效性

    https://codeforces.com/contest/1140/problem/E 局部dp + 定义状态取消后效性 题意 给你一个某些位置可以改变的字符串,假如字符串存在回文子串,那么这个字 ...

  3. Educational Codeforces Round 62 Div. 2

    突然发现上一场edu忘记写了( A:签到. #include<iostream> #include<cstdio> #include<cmath> #include ...

  4. Educational Codeforces Round 62 (Rated for Div. 2)C

    题目链接 :C. Playlist #include<bits/stdc++.h> using namespace std; #define maxn 300005 #define LL ...

  5. Educational Codeforces Round 62 (Rated for Div. 2) Solution

    最近省队前联考被杭二成七南外什么的吊锤得布星,拿一场Div. 2恢复信心 然后Div.2 Rk3.Div. 1+Div. 2 Rk9,rating大涨200引起舒适 现在的Div. 2都怎么了,最难题 ...

  6. Educational Codeforces Round 62 (Rated for Div. 2) - C Playlist

    当时题意看错了...不过大致思路是对的,唯一没有想到的就是用优先队列搞这个东西,真是不该啊... 题意大概就是,有N首歌,N首歌有两个东西,一个是长度Ti,一个是美丽值Bi,你最多可以选择K首歌, 这 ...

  7. C. Playlist Educational Codeforces Round 62 (Rated for Div. 2) 贪心+优先队列

    C. Playlist time limit per test 2 seconds memory limit per test 256 megabytes input standard input o ...

  8. Educational Codeforces Round 62 (Rated for Div. 2)

    A. Detective Book 题意:一个人读书  给出每一章埋的坑在第几页可以填完 . 一个人一天如果不填完坑他就会一直看 问几天能把这本书看完 思路:模拟一下 取一下过程中最大的坑的页数  如 ...

  9. Educational Codeforces Round 62 (Rated for Div. 2)E(染色DP,构造,思维,组合数学)

    #include<bits/stdc++.h>using namespace std;const long long mod=998244353;long long f[200007][2 ...

随机推荐

  1. .NET WebAPI 利用特性捕捉异常

    声明:本方式及代码只使用与.NET Web API. 先创建类继承ExceptionFilterAttribute类型并复写OnException方法. 代码如下: using System; usi ...

  2. InnoSetup 使用

    目录 简介 示例脚本 相关参考 在进行 WPF 程序打包发布的时候如果对程序打包没有特别高的要求,InnoSetup 足以胜任普通的程序打包发布需求,它支持安装包加密,安装包升级安装,注册表操作等常规 ...

  3. Go中多个返回值的技巧

    直接上代码看个例子吧: package main import "fmt" //返回 X+Y 和 X*Y func Computer(X, Y int) (int, int) { ...

  4. Activiti(二) springBoot2集成activiti,集成activiti在线设计器

    摘要 本篇随笔主要记录springBoot2集成activiti流程引擎,并且嵌入activiti的在线设计器,可以通过浏览器直接编辑出我们需要的流程,不需要通过eclipse或者IDEA的actiB ...

  5. jsp内置对象的作用范围

    内置对象的作用范围是指每个内置对象的某个实例在多长时间和多大的范围中有效,即在什么样的范围内可以有效地访问同一个对象实例. 在javax.servlet.jsp.PageContext的类中定义了4个 ...

  6. python 练习 simple_server 判断路径及返回函数

    函数 routers 返回一个 urlpatterns 元组,里面包含了路径名和函数名:在 函数 application 中遍历 urlpatterns 元组,路径存在则返回函数名,不存在则返回 40 ...

  7. 亚马逊 amazon connect(呼叫中心)

    背景 公司为提高客服部门沟通效率对接电话呼叫中心,调研后选择了亚马逊的Amazon Connect服务,因为是国外业务没有选择用阿里云,怕有坑. Amazon Connect后台 需要在后台创建“联系 ...

  8. javaweb登陆过滤器实现

    在web.xml中配置登陆过滤器: <!-- 配置登陆过滤器 --> <filter> <filter-name>loginFilter</filter-na ...

  9. Github:failed to add file / to index

    我把Test项目上传到github上,为了截一部分图,来写博客.所以我就上传成功之后,把仓库Respository Test删除了,但是当我再次上传的时候,发现上传不上,会提示failed to ad ...

  10. android中的websocket 应用

    websocket 在实际的应用中不仅仅能做聊天应用,还可以利用websocket长连接保持数据的实时更新以及信息的推送. websocket 的实现的关键点 第一个:首先需要引入 java-webs ...