2018.12.21 浪在ACM 集训队第十次测试赛
A Diverse Substring
B Vasya and Books
C Birthday
D LCM
A 传送门
B 传送门
题解:
这道题,就比较简单了,直接用队列模拟一下就好了,话不多说,上代码:
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
const int maxn=2e5+; int n;
int a[maxn];
bool inStack[maxn];//inStack[i]:判断数i是否再栈中 int main()
{
scanf("%d",&n);
for(int i=;i <= n;++i)
scanf("%d",a+i);
mem(inStack,true);
int index=;
for(int i=;i <= n;++i)
{
int b;
scanf("%d",&b);
if(!inStack[b] || index > n)//如果b不在栈中
{
printf("0\n");
continue;
} int res=;
while(a[index] != b)
{
inStack[a[index++]]=false;
res++;
}
inStack[a[index++]]=false;
printf("%d\n",++res);
}
return ;
}
题目来源:CodeForces - 1073B
C 传送门
题解:
定义变量 tot 表示每个人拿 tot 个硬币
依据题意可得公式:
① : tot*M - K ≥ L
② : tot*M ≤ N
联利方程①②可得
(K+L)/M ≤ tot ≤ N/M
判断能否有满足条件的 tot
AC代码:
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define ll __int64 ll N,M,K,L; ll Solve()
{
ll a=(K+L)/M+((K+L)%M == ? :);
ll b=N/M;
if(a > b)
return -;
return a;
}
int main()
{
scanf("%I64d%I64d%I64d%I64d",&N,&M,&K,&L);
printf("%I64d\n",Solve());
return ;
}
题目来源:CodeForces - 1068A
D 传送门
2018.12.21 浪在ACM 集训队第十次测试赛的更多相关文章
- 2018.12.14 浪在ACM 集训队第九次测试赛
浪在ACM 集训队第九次测试赛 B Battleship E Masha and two friends B 传送门 题意: 战船上有占地n*n的房间cells[][],只由当cells[i][j]= ...
- 2018.10.2浪在ACM 集训队第二次测试赛
2018.10.26 浪在ACM 集训队第二次测试赛 题目一览表 来源 考察知识点 A 1273 海港 NOIP 普及组 2016 差分数组+二分 B 1274 魔法阵 C 1267 金币 ...
- 2018.10.26 浪在ACM 集训队第二次测试赛
2018.10.26 浪在ACM 集训队第二次测试赛 整理人:苗学林 A海港 参考博客:[1]:李继朋https://www.cnblogs.com/violet-acmer/p/9859006.ht ...
- 2018.12.7 浪在ACM 集训队第八次测试赛
2018.12.7 浪在ACM 集训队第八次测试赛 https://blog.csdn.net/QLU_minoz/article/details/84886717 感谢苗学林同学C题和D题题解 ...
- 2018.10.19浪在ACM 集训队第一次测试赛
2018.10.19浪在ACM 集训队第一次测试赛 待参考资料: [1]:https://blog.csdn.net/XLno_name/article/details/78559973?utm_so ...
- 2018.10.26 浪在ACM 集训队第四次测试赛
2018.10.26 浪在ACM 集训队第四次测试赛 题目一览表 来源 考察知识点 完成时间 A 生活大爆炸版 石头剪刀布 NOIP 提高组 2014 模拟??? 2018.11.9 B 联合 ...
- 2018.10.2浪在ACM 集训队第三次测试赛
2018.10.26 浪在ACM 集训队第三次测试赛 今天是暴力场吗???????可怕 题目一览表 来源 考察知识点 完成时间 A 1275 珠心算测试 NOIP 普及组 2014 暴力??? 201 ...
- 2018.11.23 浪在ACM 集训队第六次测试赛
2018.11.23 浪在ACM 集训队第六次测试赛 整理人:刘文胜 div 2: A: Jam的计数法 参考博客:[1] 万众 B:数列 参考博客: [1] C:摆花 参考博客: [1] D:文化之 ...
- 2018.11.16 浪在ACM 集训队第五次测试赛
2018.11.16 浪在ACM 集训队第五次测试赛 整理人:李继朋 Problem A : 参考博客:[1]朱远迪 Problem B : 参考博客: Problem C : 参考博客:[1]马鸿儒 ...
随机推荐
- 莫烦keras学习自修第二天【backend配置】
keras的backend包括tensorflow和theano,tensorflow只能在macos和linux上运行,theano可以在windows,macos及linux上运行 1. 使用配置 ...
- 命名自我规约manual
前端: 所有文件命名都小写,多个单词连接使用 “-” 变量命名规则还是驼峰式,或者在前面加个 “_” SQL: MySQL: 所有命名都小写,无论库.表.还是字段等等,都小写 多个单词之间的分隔,使用 ...
- How to proof RSA
欧拉函数 :欧拉函数是数论中很重要的一个函数,欧拉函数是指:对于一个正整数 n ,小于 n 且和 n 互质的正整数(包括 1)的个数,记作 φ(n) . 完全余数集合:定义小于 n 且和 n 互质的数 ...
- Deconvolution用法
- xx.hbm.xml中相关重要的配置
1.<!-- 指定hibernate操作数据库时的隔离级别 #hibernate.connection.isolation 1|2|4|8 ...
- Django框架中的Context使用
Django框架中的Context使用 2017年11月09日 20:01:09 aweilark 阅读数:1113 转载自:http://www.aichengxu.com/python/606 ...
- Civil 3D 二次开发 翻转曲面高程分析颜色
不解释,直接上代码及截图. [CommandMethod("RvsSEA")] public void ReverseSurfaceElevationAnalysis() { Ci ...
- Codeforces Round #443 Div. 1
A:考虑每一位的改变情况,分为强制变为1.强制变为0.不变.反转四种,得到这个之后and一发or一发xor一发就行了. #include<iostream> #include<cst ...
- 不同版本的Chrom浏览器对应的ChromDriver的版本
附chromedriver与chrome的对应关系表: chromedriver版本 支持的Chrome版本 v2.40 v66-68 v2.39 v66-68 v2.38 v65-67 v2.37 ...
- Voltage Keepsake CodeForces - 801C (贪心 || 二分)
C. Voltage Keepsake time limit per test 2 seconds memory limit per test 256 megabytes input standard ...