题意:一条 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. 在windows服务中使用定时器

    在windows服务中,利用winform中直接拖动timer控件的方式使用定时器是不可以的,启动服务后会发现定时器并没有执行.那么在windows服务中如何使用定时器呢?  不使用直接拖动控件的方式 ...

  2. mybatis中参数为list集合时使用 mybatis in查询

    mybatis中参数为list集合时使用 mybatis in查询 一.问题描述mybatis sql查询时,若遇到多个条件匹配一个字段,sql 如: select * from user where ...

  3. MongoDB和Java(6):Spring Data整合MongoDB副本集、分片集群

    最近花了一些时间学习了下MongoDB数据库,感觉还是比较全面系统的,涉及了软件安装.客户端操作.安全认证.副本集和分布式集群搭建,以及使用Spring Data连接MongoDB进行数据操作,收获很 ...

  4. Django:内置组件Content-Type

    12.Django组件之Content_Type 1.帮助我们生成了一张表,里面有所有表名.这样不再自建表在表中填表名,用Foreignkey获取 2.为了让我们快速进入插入数据,填写一个字段Gene ...

  5. Java 之 Response 文件下载案例

    文件下载需求: 1. 页面显示超链接 2. 点击超链接后弹出下载提示框 3. 完成图片文件下载 分析过程: 1. 超链接指向的资源如果能够被浏览器解析,则在浏览器中展示,如果不能解析,则弹出下载提示框 ...

  6. 如何免费试用SAP的Fiori应用

    什么是SAP Fiori?SAP Fiori不是SAP发布的某款产品,而是SAP新一代UI设计风格和用户体验的代号. Fiori是一个意大利语中的单词,意思是"花": 不得不说SA ...

  7. python SqlServer操作

    python连接微软的sql server数据库用的第三方模块叫做pymssql(document:http://www.pymssql.org/en/stable/index.html).在官方文档 ...

  8. option触发及获取当前选中的option值

    #标签 #<select id="city" class="select"> #JavaScript #$("#city").c ...

  9. Windows10家庭版安装docker攻略

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

  10. 三、Linux_环境变量

    环境变量配置: # 每次进入命令都要重新source /etc/profile 才能生效? # 解决办法:将环境变量放置到~/.bashrc文件中 $ vim ~/.bashrc # 在里面添加相关的 ...