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 ...
随机推荐
- 001Spring 定时任务 Scheduled
01.@Scheduled注解参数 @Scheduled支持fixedRate.fixedDelay.cron表达式参数.其中,fixedRate和fixedDelay没有区别,都是启动时执行1次,每 ...
- IntelliJ IDEA快速创建属性字段的get和set方法
1.写好属性字段后,在代码面板右击,选择generator… 再选择 Getter and Setter 全选中(Ctrl + A),点击OK! 2.也可以选择使用快捷键:alt+inse ...
- Android SQLite与AutoCompleteTextView
读取SQLite中的数据显示在AutoCompleteTextView中,支持动态加入SQLite中不存在的数据. package zhang.ya; import java.io.File; imp ...
- J2EE项目工具集(转)
1.支持重构,TDD, Debug J2EE应用和Flying Error提示的IDE a.重构:即使团队用的最多的只是Rename,Move,Extract Method等有限几个最基本的功能,但J ...
- ST Link 调试问题总结
用过ST Link调试工具的同事都应该知道,ST Link是一个很不错的调试工具,它具有小并且功能齐全,价格便宜等特点,现在市场上普遍是下面这两种ST Link, 但如果用的比较多,会发现有时候会存在 ...
- css properties
white-space:描述如何处理元素中的空格 word-wrap:(以单词为单位,比如长单词则转行拆分,短单词则直接留空换行!) 用来说明当一个不能被分开的字符串太长因而其containing b ...
- 【Leetcode】【Medium】Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parenthes ...
- Python初学者第七天 字符串及简单操作
7day 数据类型:字符串 1.定义 字符串是一个有序的字符的集合,用于储存和表示基本的文本信息.单.双.三引号之间的内容称之为字符串: a = ‘hello world!’ b = "你好 ...
- css如何制作八边形
随着技术的发展,css也越发强大,css可以制作很多有趣的图形,让我们一起来看一下如何使用css制作一个八边形吧. 方法/步骤 1新建一个html文件.如图: 在html文件上创建一个 ...
- AutoHotkey调用VBA实现批量精确筛选数据透视表某字段内容。
如上图,想在数据透视表中只显示红色区域的内容,手动勾选就比较繁琐. 实现思路: 先复制红色的内容. 鼠标停留在数据透视表[型号]列的任意数据上(通过该单元格可以获取数据透视表和字段) 由于数据透视表的 ...