大水题。。。

题目要求你求能看到的灯笼数,我们可以分为3部分

  • 总共的灯笼数——————1

  • 在 l 左面的灯笼数(不包括lll)——————2

  • 在 r 左面的灯笼数(包括rrr)——————3

我们知道,由上面的2-3就是被另一列车挡住的灯笼数

所以1-2+3就是答案;

代码:

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define rii register int i
#define rij register int j
using namespace std;
int t,len,l,r,v;
void solve()
{
scanf("%d%d%d%d",&len,&v,&l,&r);
int sl1=len/v;
int sl2=(l-)/v;
int sl3=r/v;
sl1-=sl3;
sl1+=sl2;
printf("%d\n",sl1);
}
int main()
{
int t;
scanf("%d",&t);
for(rii=;i<=t;i++)
{
solve();
}
}

CF1066A Vova and Train(模拟)的更多相关文章

  1. 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, ...

  2. Codeforces 1082B Vova and Trophies 模拟,水题,坑 B

    Codeforces 1082B Vova and Trophies https://vjudge.net/problem/CodeForces-1082B 题目: Vova has won nn t ...

  3. Codeforces Round #594 (Div. 1) C. Queue in the Train 模拟

    C. Queue in the Train There are

  4. Vova and Train (codeforces 1066A)

    数学题.用右边界以内的区间内的灯减去左边界以内区间内的灯,并且如果左边界正好有灯再减去一即可 我的代码 #include <bits/stdc++.h> using namespace s ...

  5. A. Vova and Train ( Codeforces Round #515 (Div. 3) )

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

  6. Codeforces Round #515 (Div. 3)

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

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

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

  8. Organize Your Train part II-POJ3007模拟

    Organize Your Train part II Time Limit: 1000MS Memory Limit: 65536K Description RJ Freight, a Japane ...

  9. HDU 1022 Train Problem I(栈模拟)

    传送门 Description As the new term comes, the Ignatius Train Station is very busy nowadays. A lot of st ...

随机推荐

  1. JSTL数据格式化

    日期表示 <fmt:formatDate value="${DATE1}" pattern="yyyy-MM-dd hh:mm:ss" type=&quo ...

  2. RxJava 中的map与flatMap

    1.map和flatMap都是接受一个函数作为参数(Func1) 2.map函数只有一个参数,参数一般是Func1,Func1的<I,O>I,O模版分别为输入和输出值的类型,实现Func1 ...

  3. QT5.3 杂记

    Qt5下,QWidget系列从QtGui中被剥离出去,成为单独的QtWidget模块.随着Qt Quick2的引入,QtDeclarative也逐渐和QWidget系列也脱离关系. 最终:在Qt5下的 ...

  4. 深入理解并发编程之----synchronized实现原理

    版权声明:本文为博主原创文章,请尊重原创,未经博主允许禁止转载,保留追究权 https://blog.csdn.net/javazejian/article/details/72828483 [版权申 ...

  5. 又续CSS3

    这次主要讲呢 1.box-sizing属性 语法:box-sizing: content-box|border-box|inherit; box-sizing属性的用法 box-sizing属性可以为 ...

  6. ArrayList排序Sort()方法(转)

    //使用Sort方法,可以对集合中的元素进行排序.Sort有三种重载方法,声明代码如下所//示. public void Sort(); //使用集合元素的比较方式进行排序 public void S ...

  7. React - React Developer Tools开发者工具的安装与使用(Chrome调试插件)

    原文地址:http://www.cnplugins.com/zhuanti/how-to-use-react-tools.html 虽然我们曾经在React开发者工具的基础介绍里面有概括性的介绍过Re ...

  8. layui 设计资源——2.0 版本的 Axure 组件包,产品交互设计利器

    大家好,很久不见,这次为大家分享的是 layui_2.0版本的axure组件包,在去年发布的 layui Axure 1.0 中(见:http://fly.layui.com/jie/9842/ )赢 ...

  9. WCF如何使用X509证书 z

    WCF如何使用X509证书 如何创建证书: makecert.exe -sr LocalMachine -ss My -a sha1 -n CN=JiangServer -sky exchange - ...

  10. Hadoop学习---Eclipse中hadoop环境的搭建

    在eclipse中建立hadoop环境的支持 1.需要下载安装eclipse 2.需要hadoop-eclipse-plugin-2.6.0.jar插件,插件的终极解决方案是https://githu ...