CF1066A Vova and Train(模拟)
大水题。。。
题目要求你求能看到的灯笼数,我们可以分为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(模拟)的更多相关文章
- 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, ...
- Codeforces 1082B Vova and Trophies 模拟,水题,坑 B
Codeforces 1082B Vova and Trophies https://vjudge.net/problem/CodeForces-1082B 题目: Vova has won nn t ...
- Codeforces Round #594 (Div. 1) C. Queue in the Train 模拟
C. Queue in the Train There are
- Vova and Train (codeforces 1066A)
数学题.用右边界以内的区间内的灯减去左边界以内区间内的灯,并且如果左边界正好有灯再减去一即可 我的代码 #include <bits/stdc++.h> using namespace s ...
- A. Vova and Train ( Codeforces Round #515 (Div. 3) )
题意:一条 L 长的路,一列车长在这条路的 l 到 r 之间,只有在 v 倍数时有灯,但是在 l 到 r 之间的灯是看不见的,问最大看见的灯的个数? 题解:L / v 表示总共的灯的个数, r / v ...
- Codeforces Round #515 (Div. 3)
Codeforces Round #515 (Div. 3) #include<bits/stdc++.h> #include<iostream> #include<cs ...
- Codeforces Round #515 (Div. 3) 解题报告(A~E)
题目链接:http://codeforces.com/contest/1066 1066 A. Vova and Train 题意:Vova想坐火车从1点到L点,在路上v的整数倍的点上分布着灯笼,而在 ...
- Organize Your Train part II-POJ3007模拟
Organize Your Train part II Time Limit: 1000MS Memory Limit: 65536K Description RJ Freight, a Japane ...
- HDU 1022 Train Problem I(栈模拟)
传送门 Description As the new term comes, the Ignatius Train Station is very busy nowadays. A lot of st ...
随机推荐
- Windows操作系统下给文件夹右键命令菜单添加启动命令行的选项
在命令行中或按下[WIN]+[R]键启动运行对话框的情况下,输入regedit命令启动注册表编辑器,在HKEY_CLASSES_ROOT\Folder\shell下增加一个“CMD”(此处名字可以随便 ...
- 基础架构之Maven私有库
Maven对于Java开发来说肯定不会陌生,由于各种问题,公司常常需要搭建自己的私有Maven仓库. (一) 环境要求 Centos 7.5.1804 Docker 18.06.1-ce sonat ...
- Anaconda 执行命令报ssl错误
- Qt判断鼠标在控件上
QT判断鼠标是否在某子窗口控件上方 需要注意的是,子窗口获取geometry,是相对于父窗口的相对位置,QCursor::pos()获取的是鼠标绝对位置,要不将父窗口的相对位置进行换算,要不将鼠标的绝 ...
- tpcc-mysql安装测试与使用生成对比图
1:下载tpcc-mysql的压缩包,从下面的网站进行下载 https://github.com/Percona-Lab/tpcc-mysql 也可直接从叶总博客直接下载: http://imysql ...
- 遍历查询结果集,update数据
select NULL mykey, * into #mytemp from dbo.DIM_DISTRIBUTOR declare @i int begin ) print @i )) where ...
- NSJSONSerialization能够处理的JSONData
NSJSONSerialization能够处理的JSONData You use the NSJSONSerialization class to convert JSON to Foundation ...
- Ubuntu下安装CUDA
cuda check: cuDNN 下载cuDNN后解压 更新软链接 更新链接库 symbol link 参考链接: http://docs.nvidia.com/cuda/cuda-installa ...
- iotop使用详解
iotop是top和iostat程序的混合体,能够显示系统中所有运行进程并将进程根据I/O统计信息排序. 这个软件使用了Linux内核的一些新特性,所以需要2.6.20或者更新的内核. 一般默认情况下 ...
- 028class_part2
1.成员修饰符 2.特殊成员 3.metaclass,类的祖宗 ###成员修饰符###公有和私有 #__author:_nbloser #date:2018/1/19 #私有类.对象成员 ...