大水题。。。

题目要求你求能看到的灯笼数,我们可以分为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. 十、一行多个:使用float布局的经典方法 ---接(一)

    1.使用float必须要清除float:即在使用float元素的父级元素上清除float. 清除float的方法有三种,在父元素上加:1.width: 100% 或者固定宽度 +overflow:hi ...

  2. gradle中文学习资料

    http://wiki.jikexueyuan.com/project/GradleUserGuide-Wiki/ https://www.gitbook.com/book/lippiouyang/g ...

  3. python 二叉树计算器

    例子:计算1+2+3+4的值 代码: class Buffer(object): """字符串处理函数""" def __init__(se ...

  4. classifier.cc-recv() [ns2.35]

    //without comments int chooseECNSlot() { ; ;i<=nslot_;i++) { *count) { *count); )*ti; ;j<=nslo ...

  5. win 8系统:System.IO.FileNotFoundException: 未能加载文件或程序集“CefSharp.Core.dll”或它的某一个依赖项。找不到指定的模块

    最近用CefSharp做了一个chrome核心的浏览器. 在win 7.win 10系统上都正常运行,但是在win 8系统上报错了. win 8系统:System.IO.FileNotFoundExc ...

  6. UML面向对象建模基础

    一个比较好的UML教程PPT https://wenku.baidu.com/view/cf80902e26284b73f242336c1eb91a37f11132ac.html

  7. 解决Unity3D操作界面字体模糊的问题

    新装的电脑安装了UNITY后,操作界面的字体异常模糊,搜了半天看看有没有换字体的功能,也没找到 后来快放弃的时候,偶然看到这篇文章http://eyehere.net/2014/unity3d-int ...

  8. ArcSde服务启动后又停止

    问题:突然发现ArcSde服务无法启动,“ArcSde服务启动后又停止,......” 环境:Win7+ArcSDE10 +Oracle11g 由于本人使用ArcSde时间不长,基本没有遇到过什么问题 ...

  9. Ettercap结合sslstrip对ssl/https进行攻击

    Ettercap是一个非常强大的嗅探欺骗工具:在以往的ettercap的使用过程中,我们大多用来嗅探http,ftp,和一些加密比较简单的邮箱等的密码,对于新型的ssl/https等的加密协议就显得不 ...

  10. Java中父类强制转换为子类的可能

    之前徒弟问了一个问题, 在Java中, 父类对象到底能不能转换成对应的子类对象? 到底能不能, 今天就来说说这个问题, 先看下面一段代码: package cn.com.hanbinit.test; ...