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. Chrome F12调试工具常用技巧

    原文地址:http://www.cnblogs.com/MuYunyun/p/5678405.html#3471461 阅读目录 Chrome调试工具介绍: 快速切换文件 在源代码中搜索 在源代码中快 ...

  2. C#生成随机数的三种方法

    随机数的定义为:产生的所有数字毫无关系. 在实际应用中很多地方会用到随机数,比如需要生成唯一的订单号. 在C#中获取随机数有三种方法: 一.Random 类 Random类默认的无参构造函数可以根据当 ...

  3. 【Dojo 1.x】笔记7 配置对象dojoConfig的内容1:has属性、加载器的属性

    说完了出身,即出身自dojo/_base/目录下的config模块,那就要好好讲讲这对象有什么可以写的属性了. 1. has属性 官方说是用于更好的特征检测的,具体有什么用现在还不得知. 例如: &l ...

  4. 从.Net到Java学习第十二篇——SpringBoot+JPA提供跨域接口

    从.Net到Java学习系列目录 最近又撸了半个月的前端代码,做app离线存储,然后又花了一周去将过去的wcf项目转webapi,java又被落下了,总感觉我特么像斗地主中的癞子牌,变来变去..... ...

  5. Android: 在native中访问assets全解析

    本文总结在Android Native C++开发中访问APK中的assets资源的方法 在CMake中添加相关NDK LIB的 依赖 因为我们接下来用到的一些函数实现在NDK库libandroid. ...

  6. 仿9GAG制作过程(一)

    有话要说: 准备开始学习Android应用程序的一个完整的设计过程.准备做一个仿9GAG的APP,前端界面设计+后台数据爬虫+后台接口设计,整个流程体验一遍.今天准备先把前端界面的框架给完成了. 成果 ...

  7. foaf

    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http: ...

  8. 章节九、1-Selenium环境配置

    一.Selenium环境安装配置,这里使用Selenium WebDriver 3.6.0 1.下载Selenium WebDriver (点击后网站响应比较慢,需要多等等) 2.打开该网址后点击“d ...

  9. 虚拟机安装macos 分辨率不正常修改不了,不能全屏如何解决

    1.苹果在OSX 10.11之后启动了一个System Integrity Protection (SIP),这个保护系统防止/library/preferences/systemconfigurat ...

  10. web.xml设置过滤直接访问

    <security-constraint> <web-resource-collection> <web-resource-name>JSPs</web-re ...