数学题。用右边界以内的区间内的灯减去左边界以内区间内的灯,并且如果左边界正好有灯再减去一即可

我的代码

#include <bits/stdc++.h>
using namespace std;
main()
{
int n;
cin>>n;
while(n--)
{
int ll,v,l,r;
int num=0;int sum=0;
cin>>ll>>v>>l>>r;
num=ll/v;sum=r/v-l/v;
if(l%v==0)
sum+=1;
cout<<num-sum<<endl;
}
}

Vova and Train (codeforces 1066A)的更多相关文章

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

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

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

  3. Vova and Trophies CodeForces - 1082B(思维题)

    Vova has won nn trophies in different competitions. Each trophy is either golden or silver. The trop ...

  4. 『ACM C++』 Codeforces | 1066A - Points in Segments

    大一生活真 特么 ”丰富多彩“ ,多彩到我要忙到哭泣,身为班长,很多班级的事情需要管理,也是,什么东西都得体验学一学,从学生会主席.团委团总支.社团社长都体验过一番了,现在差个班长也没试过,就来体验了 ...

  5. CF1066A Vova and Train(模拟)

    大水题... 题目要求你求能看到的灯笼数,我们可以分为3部分 总共的灯笼数——————1 在 l 左面的灯笼数(不包括lll)——————2 在 r 左面的灯笼数(包括rrr)——————3 我们知道 ...

  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. Codeforces 1082B Vova and Trophies 模拟,水题,坑 B

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

  9. CodeForces Round #527 (Div3) D2. Great Vova Wall (Version 2)

    http://codeforces.com/contest/1092/problem/D2 Vova's family is building the Great Vova Wall (named b ...

随机推荐

  1. C 语言宏快速入门

    //####### 参照C语言的预处理命令简介 ######## #define 定义一个预处理宏 #undef 取消宏的定义 #include 包含文件命令 #include_next 与#incl ...

  2. C 基础 全局变量

    /** 被static修饰的局部变量 1.只有一份内存, 只会初始化一次 2.生命周期会持续到程序结束 3.static改变了局部变量的生命周期, 但是不能改变局部变量的作用域 被static修饰的全 ...

  3. 使用 Pascal 脚本编写网页, PWP 项目

    下载后得到 pwp.rar 文件. 解压到一个文件夹里面, 比方  e:\my_sys 文件夹下. 设计一下的脚本. 測试能否够执行. <%  uses sysutils; begin      ...

  4. Cache-control no-transform Robots Exclusion Protocol

    蜘蛛协议 <今日头条>支持蜘蛛协议(Robots Exclusion Protocol)"ToutiaoSpider",同时,我们尊重所有的网络媒体,如媒体不希望内容被 ...

  5. Codeforces Beta Round #67 (Div. 2)C. Modified GCD

    C. Modified GCD time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  6. Android属性系统简介【转】

    本文转载自:http://www.cnblogs.com/l2rf/p/6610348.html 1.简介 在android 系统中,为统一管理系统的属性,设计了一个统一的属性系统.每个属性都有一个名 ...

  7. LaTeX 在线编辑器(LaTeX online editors)

    eqneditor:有强大的几乎所有常用的数学符号对应的图标形式,便于快速完成latex公式编辑且易于粘贴拷贝. 此外,更为重要的一点是,随着编辑窗口内公式的编辑,会在页面的底部,自动生成其对应的 h ...

  8. 异常java.lang.UnsupportedOperationException: The application must supply JDBC connections

    转自:https://blog.csdn.net/q952420873/article/details/81355586 先上图  根据这个错误溯源 于是 我来到了数据库连接部分的代码 ,发现多了一个 ...

  9. 如何通过XInput技术针对游戏方向盘或者手柄编程

    目前市面上的游戏外设,要么支持传统的DirectInput接口,要么支持最新的XInput技术.今天在这里聊一聊,如何通过XInput技术实现对这类游戏外设相关信息的捕获.关于DirectInput与 ...

  10. Centos7 时间不正确修复

    查看系统支持的时区列表 timedatectl list-timezones 使用 date -R 查看时区是否正确 date -R 修改时区 timedatectl set-timezone Asi ...