浪在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 集训队第十次测试赛的更多相关文章

  1. 2018.12.14 浪在ACM 集训队第九次测试赛

    浪在ACM 集训队第九次测试赛 B Battleship E Masha and two friends B 传送门 题意: 战船上有占地n*n的房间cells[][],只由当cells[i][j]= ...

  2. 2018.10.2浪在ACM 集训队第二次测试赛

    2018.10.26 浪在ACM 集训队第二次测试赛 题目一览表 来源 考察知识点 A 1273 海港 NOIP 普及组 2016 差分数组+二分 B 1274 魔法阵     C 1267 金币   ...

  3. 2018.10.26 浪在ACM 集训队第二次测试赛

    2018.10.26 浪在ACM 集训队第二次测试赛 整理人:苗学林 A海港 参考博客:[1]:李继朋https://www.cnblogs.com/violet-acmer/p/9859006.ht ...

  4. 2018.12.7 浪在ACM 集训队第八次测试赛

    2018.12.7 浪在ACM 集训队第八次测试赛  https://blog.csdn.net/QLU_minoz/article/details/84886717   感谢苗学林同学C题和D题题解 ...

  5. 2018.10.19浪在ACM 集训队第一次测试赛

    2018.10.19浪在ACM 集训队第一次测试赛 待参考资料: [1]:https://blog.csdn.net/XLno_name/article/details/78559973?utm_so ...

  6. 2018.10.26 浪在ACM 集训队第四次测试赛

    2018.10.26 浪在ACM 集训队第四次测试赛 题目一览表 来源 考察知识点 完成时间 A 生活大爆炸版 石头剪刀布  NOIP 提高组 2014   模拟???  2018.11.9 B 联合 ...

  7. 2018.10.2浪在ACM 集训队第三次测试赛

    2018.10.26 浪在ACM 集训队第三次测试赛 今天是暴力场吗???????可怕 题目一览表 来源 考察知识点 完成时间 A 1275 珠心算测试 NOIP 普及组 2014 暴力??? 201 ...

  8. 2018.11.23 浪在ACM 集训队第六次测试赛

    2018.11.23 浪在ACM 集训队第六次测试赛 整理人:刘文胜 div 2: A: Jam的计数法 参考博客:[1] 万众 B:数列 参考博客: [1] C:摆花 参考博客: [1] D:文化之 ...

  9. 2018.11.16 浪在ACM 集训队第五次测试赛

    2018.11.16 浪在ACM 集训队第五次测试赛 整理人:李继朋 Problem A : 参考博客:[1]朱远迪 Problem B : 参考博客: Problem C : 参考博客:[1]马鸿儒 ...

随机推荐

  1. python web需要了解哪些

    1. socket.tcp/ip.http(cookie.session.token).https.ssl 2. wsgi:https://www.python.org/dev/peps/pep-33 ...

  2. delphi 子窗体只能最小化不能关闭的解决方案

    cnpack下载地址:http://www.cnpack.org/showdetail.php?id=726&lang=zh-cn 时候创建的子窗体不能关闭,点关闭按钮时子窗体最小化了. 出现 ...

  3. java开发支付宝支付详细流程_demo的运行

    首先我要吐槽一下支付宝的开放平台简直就是一个迷宫,赞同的顶一下,下面我把要下载的地址给贴出来要不真不好找: 一.准备工作 1.签名工具下载 https://docs.open.alipay.com/2 ...

  4. zookeeper客户端操作

    ZooKeeper客户端 zkCli.sh 节点的增删改查 在 bin 目录下的  zkCli.sh  就是ZooKeeper客户端 ./zkCli.sh -timeout 5000  -server ...

  5. Jetson TX1 install py-faster-rcnn

    Install py-faster-rcnn following the official version  https://github.com/rbgirshick/py-faster-rcnn ...

  6. Build 2017 Revisited: .NET, XAML, Visual Studio

    For the next couple months we're going to revisit Build 2017, each post focusing on different aspect ...

  7. poj2100(尺取法)

    题意:选取一系列数,使得这些数的平方和等于n: 解题思路:尺取法扫一遍: #include<iostream> #include<algorithm> using namesp ...

  8. kubernetes 构架

  9. P1880 [NOI1995]石子合并 区间dp+拆环成链

    思路 :一道经典的区间dp  唯一不同的时候 终点和起点相连  所以要拆环成链  只需要把1-n的数组在n+1-2*n复制一遍就行了 #include<bits/stdc++.h> usi ...

  10. 洛谷P2764 最小路径覆盖问题

    有向无环图的最小路径点覆盖 最小路径覆盖就是给定一张DAG,要求用尽量少的不相交的简单路径,覆盖有向无环图的所有顶点. 有定理:顶点数-路径数=被覆盖的边数. 要理解的话可以从两个方向: 假设DAG已 ...