题意:一条 L 长的路,一列车长在这条路的 l 到 r 之间,只有在 v 倍数时有灯,但是在 l 到 r 之间的灯是看不见的,问最大看见的灯的个数?

题解:L / v 表示总共的灯的个数, r / v 、( l - 1 ) / v 表示前 r 、( l - 1 ) 长的路有多少灯,减一下就可以了。

( 难题补不上了,QAQ,写个水题,放松一下)

#include <iostream>
#include <bits/stdc++.h>
using namespace std; int main()
{
int t,L,v,l,r,sum,num;
while(~scanf("%d",&t))
{
while(t--)
{
scanf("%d%d%d%d",&L,&v,&l,&r);
sum = 0;
num = 0;
sum = L / v;
num = r / v - (l - 1) / v;
printf("%d\n",sum - num);
}
}
return 0;
}

A. Vova and Train ( Codeforces Round #515 (Div. 3) )的更多相关文章

  1. Codeforces Round #515 (Div. 3)

    Codeforces Round #515 (Div. 3) #include<bits/stdc++.h> #include<iostream> #include<cs ...

  2. Codeforces Round #515 (Div. 3) 解题报告(A~E)

    题目链接:http://codeforces.com/contest/1066 1066 A. Vova and Train 题意:Vova想坐火车从1点到L点,在路上v的整数倍的点上分布着灯笼,而在 ...

  3. CodeForces Round #515 Div.3 A. Vova and Train

    http://codeforces.com/contest/1066/problem/A Vova plans to go to the conference by train. Initially, ...

  4. Codeforces Round #515 (Div. 3) B. Heaters【 贪心 区间合并细节 】

    任意门:http://codeforces.com/contest/1066/problem/B B. Heaters time limit per test 1 second memory limi ...

  5. CodeForces Round #515 Div.3 B. Heaters

    http://codeforces.com/contest/1066/problem/B Vova's house is an array consisting of nn elements (yea ...

  6. Codeforces Round #515 (Div. 3) E. Binary Numbers AND Sum

    E. Binary Numbers AND Sum 题目链接:https://codeforces.com/contest/1066/problem/E 题意: 给出两个用二进制表示的数,然后将第二个 ...

  7. CodeForces Round #515 Div.3 D. Boxes Packing

    http://codeforces.com/contest/1066/problem/D Maksim has nn objects and mm boxes, each box has size e ...

  8. CodeForces Round #515 Div.3 C. Books Queries

    http://codeforces.com/contest/1066/problem/C You have got a shelf and want to put some books on it. ...

  9. CodeForces Round #515 DIv.3 F. Yet another 2D Walking

    http://codeforces.com/contest/1066/problem/F Maksim walks on a Cartesian plane. Initially, he stands ...

随机推荐

  1. Kubernetes第十一章--部署微服务电商平台

  2. JUC - Monitor监控ThreadPoolExecutor

    JUC - Monitor监控ThreadPoolExecutor 一个自定义Monitor监控ThreadPoolExecutor的执行情况 TASK WokerTask class WorkerT ...

  3. JAVA9之后废弃newInstance()方法

    JAVA9之后废弃newInstance()方法 根据JAVA11的API 我们可以看见反射中的newInstance()方法不推荐使用了,用 clazz.getDeclaredConstructor ...

  4. 安装nginx + nginx-gridfs + mongodb

    1.安装依赖包 yum -y install pcre-devel openssl-devel zlib-devel git gcc gcc-c++ git clone https://github. ...

  5. day 21 作业

    定义MySQL类 对象有id.host.port三个属性 定义工具create_id,在实例化时为每个对象随机生成id,保证id唯一 提供两种实例化方式,方式一:用户传入host和port 方式二:从 ...

  6. C/C++调试:gdbserver的简单使用

    1.角色:host和target host是运行gdb的机器 target是运行gdbserver的机器 gdbserver提供一个网络服务,gdb remote到gdbserver上后进行调试 2. ...

  7. Docke 镜像加速

    一.国内获取Docker镜像时,访问 https://hub.docker.com/速度缓慢,只有几十K左右,这种情况可以使用国内的一些docker镜像,国内有些企业做了镜像拷贝工作,这样,我们就可以 ...

  8. Windows10家庭版安装docker攻略

    在公司,一直使用mac系统,在mac上安装使用docker还是比较方便的,可本人心血来朝,家里是win10 home版,就想在windows上刷一刷. 好了,废话不多说,直接上干货. 为了不误导广大爱 ...

  9. Shell脚本编程30分钟入门(小结)(转)

    原文链接https://www.jb51.net/article/161028.htm 什么是Shell脚本 Shell脚本(英语:Shell script),又称Shell命令稿.程序化脚本,是一种 ...

  10. 你真的理解CountDownLatch与CyclicBarrier使用场景吗?

    原文:https://blog.csdn.net/zzg1229059735/article/details/61191679 相信每个想深入了解多线程开发的Java开发者都会遇到CountDownL ...