Codeforces 1136 - A/B/C/D/E - (Done)
链接:https://codeforces.com/contest/1136/
A - Nastya Is Reading a Book - [二分]
#include<bits/stdc++.h>
using namespace std;
const int maxn=;
int n,l[maxn],r[maxn],k;
int srch(int x)
{
int L=, R=n;
while(L<R)
{
int M=(L+R)>>;
if(l[M]<=x && x<=r[M]) return M;
else if(x<l[M]) R=M-;
else L=M+;
}
return L;
}
int main()
{
ios::sync_with_stdio();
cin.tie(), cout.tie(); cin>>n;
for(int i=;i<=n;i++) cin>>l[i]>>r[i];
cin>>k; cout<<n-srch(k)+<<endl;
}
B - Nastya Is Playing Computer Games - [思维题]
题解:我只想说,这道思维题有点东西……
AC代码:
#include<bits/stdc++.h>
using namespace std;
int n,k;
int main()
{
cin>>n>>k;
cout<<*n+min(n-k,k-)<<endl;
}
C - Nastya Is Transposing Matrices - [有趣的矩阵题]
D - Nastya Is Buying Lunch - [贪心+链表+map]
E - Nastya Hasn't Written a Legend - [线段树+二分]
Codeforces 1136 - A/B/C/D/E - (Done)的更多相关文章
- codeforces#1136 C. Nastya Is Transposing Matrices(找规律)
题意:给出两个n*m的矩阵,每次操作可以让一个正方形矩阵行列交换.问,在无限次操作下,第一个矩阵能否变成第二个矩阵 分析:先把操作限定在2*2的矩阵中.这样对角线上的元素就可以随意交换.也就是说,如果 ...
- codeforces#1136E. Nastya Hasn't Written a Legend(二分+线段树)
题目链接: http://codeforces.com/contest/1136/problem/E 题意: 初始有a数组和k数组 有两种操作,一,求l到r的区间和,二,$a_i\pm x$ 并且会有 ...
- Codeforces Round #546 (Div. 2)
http://codeforces.com/contest/1136 A #include <bits/stdc++.h> using namespace std; ; int N, K; ...
- Codeforces 1136E - Nastya Hasn't Written a Legend - [线段树+二分]
题目链接:https://codeforces.com/problemset/problem/1136/E 题意: 给出一个 $a[1 \sim n]$,以及一个 $k[1 \sim (n-1)]$, ...
- Codeforces 1136D - Nastya Is Buying Lunch - [贪心+链表+map]
题目链接:https://codeforces.com/problemset/problem/1136/D 题意: 给出 $1 \sim n$ 的某个排列 $p$,再给出若干 $(x,y)$ 表示当序 ...
- Codeforces 1136C - Nastya Is Transposing Matrices
题目链接:https://codeforces.com/problemset/problem/1136/C 题意: 给出 $n \times m$ 的矩阵 $A,B$,你可以对其中任意某个 $k \t ...
- Codeforces Round #546 (Div. 2) E 推公式 + 线段树
https://codeforces.com/contest/1136/problem/E 题意 给你一个有n个数字的a数组,一个有n-1个数字的k数组,两种操作: 1.将a[i]+x,假如a[i]+ ...
- Codeforces Round #546 (Div. 2) D 贪心 + 思维
https://codeforces.com/contest/1136/problem/D 贪心 + 思维 题意 你面前有一个队列,加上你有n个人(n<=3e5),有m(m<=个交换法则, ...
- Codeforces Round #546 (Div. 2) 题解
Codeforces Round #546 (Div. 2) 题目链接:https://codeforces.com/contest/1136 A. Nastya Is Reading a Book ...
随机推荐
- EF Migrations error: No connection string named 'MpDb' could be found in the application config file.
solution: update-database 命令查找连接字符是在当前启动项目中找的 确保启动项目中connectiongString配置存在.
- 使用日志服务进行Kubernetes日志采集
阿里云容器服务Kubernetes集群集成了日志服务(SLS),您可在创建集群时启用日志服务,快速采集Kubernetes 集群的容器日志,包括容器的标准输出以及容器内的文本文件. 新建 Kubern ...
- 评分模型的检验方法和标准&信用评分及实现
评分模型的检验方法和标准通常有:K-S指标.交换曲线.AR值.Gini数等.例如,K-S指标是用来衡量验证结果是否优于期望值,具体标准为:如果K-S大于40%,模型具有较好的预测功能,发展的模型具有成 ...
- 很烦人的maven和gradle的jar缓存
1. 起因 a. 最近在学习大数据相关东西,自然就少不免去操作linux系统,更别说不敲命令 b. 然而那个配置软件时,很经常使用ln -s为一个软件目录(带着版本或者其他信息的长命名)创建别名(软连 ...
- 【css】垂直居中的几种写法
结构 <div class="vam"> <div class="vam-body">垂直居中</div> </div ...
- 蜕变成蝶~Linux设备驱动之watchdog设备驱动
看门狗(watchdog )分硬件看门狗和软件看门狗.硬件看门狗是利用一个定时器 电路,其定时输出连接到电路的复位端,程序在一定时间范围内对定时器清零 (俗称 “喂狗”),如果程序出现故障,不在定时周 ...
- Ext-JS-Classic-Demo 面向pc端示例
基于Ext Js 6.5.1 面向pc端示例,低于此版本可能存在兼容问题,慎用 已忽略编译目录,请自行编译运行 Sencha Cmd 版本:v6.5.1.240 git地址:https://githu ...
- nginx 报错 connect() failed (111: Connection refused) while connecting to upstream
公司网站搬迁到新服务器后,发现站点访问不了,network里面提示502,查看相关的server配置,感觉没有什么问题,经过测试发现txt.html.等非php文件能够直接访问,也就是php访问不了, ...
- gitlab-ci + k8s 之docker (三)
docker 在本系列(一)中(https://www.cnblogs.com/huandada/p/9965771.html)的runner_tomcat.sh脚本有涉及到镜像的推送,本文主要记录整 ...
- UnicodeEncodeError: 'latin-1' codec can't encode characters in position 41-50: ordinal not in range(256)
在处理标题或网址为中文的文件或网页的时候,报UnicodeEncodeError: 'latin-1' codec can't encode characters in position 41-50: ...