大水题。。。

题目要求你求能看到的灯笼数,我们可以分为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. sql中replace的用法

    update 表名 set 字段名=REPLACE (字段名,'原来的值','要修改的值') 如:将tbl_user表的user_name字段中的大写的A替换成小写的a update tbl_stud ...

  2. python小练习2

    结果 代码 鞋子价格=0 男孩价格=0 爆米花价格=0 计算完毕=0 for 鞋子动态价格 in range(0,20): if (计算完毕==1): break; #print("鞋子动态 ...

  3. CSS浮动并清除浮动(造成的影响)

    一.浮动 CSS浮动    CSS float浮动的深入研究.详解及拓展(一)    CSS浮动属性Float详解 块级元素独占一行 块级元素,在页面中独占一行,自上而下排列,也就是传说中的流. 可以 ...

  4. ES入门——数组的扩展

    1.Array.from() 该方法用于将两类对象转为真正的数组:类似数组的对象(array-like object)和可遍历(iterable)的对象,包括ES6新增的数据结构Set和Map.下面是 ...

  5. Scrum----学习心得

    Scrum学习心得 什么是敏捷开发? 敏捷开发(Agile Development)是一种以人为核心.迭代.循序渐进的 开发方法.它不是一门技术,它是一种开发方法,也就是一种软件开发的流程,它会指导我 ...

  6. C++ 11: function & bind 使用示例

    #include <functional> #include <iostream> struct Foo { Foo(int num) : num_(num) {} void ...

  7. centos7和centos6区别

    CentOS 7 vs CentOS 6的不同   (1)桌面系统[CentOS6] GNOME 2.x[CentOS7] GNOME 3.x(GNOME Shell) (2)文件系统[CentOS6 ...

  8. CVE-2013-3897漏洞成因与利用分析

    CVE-2013-3897漏洞成因与利用分析 1. 简介 此漏洞是UAF(Use After Free)类漏洞,即引用了已经释放的内存.攻击者可以利用此类漏洞实现远程代码执行.UAF漏洞的根源源于对对 ...

  9. CefSharp 浏览器核心,爬虫

    CefSharp是什么 A framework for embedding web-browsing-like capabilities to a standard .NET application ...

  10. tp5中分页携带参数的方法

    $list = $model->where(...)->order(.....)->paginate($size, false, [                'query' = ...