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 ...
随机推荐
- MongoDB 删除集合
drop() 方法 MongoDB 的 db.collection.drop() 是用来从数据库中删除一个集合. 语法: drop() 命令的基本语法如下 db.COLLECTION_NAME.dro ...
- iDempiere 使用指南 开发环境搭建
Created by 蓝色布鲁斯,QQ32876341,blog http://www.cnblogs.com/zzyan/ iDempiere官方中文wiki主页 http://wiki.idemp ...
- arcgis-Pro-1.3
sdk在线地址 http://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic14079.html 看了下,整体开发架构全变了. 觉得不如以前com ...
- [PE格式分析] 4.IMAGE_FILE_HEADER
源代码如下: typedef struct _IMAGE_FILE_HEADER { +04h WORD Machine; // 运行平台 +06h WORD NumberOfSections; // ...
- mybatis支持的jdbc类型
参考mybatis的枚举JdbcType源码: 关于这些类型mybatis是如何处理可以看一下TypeHandler类的源码.
- 【NLP_Stanford课堂】语言模型3
一.产生句子 方法:Shannon Visualization Method 过程:根据概率,每次随机选择一个bigram,从而来产生一个句子 比如: 从句子开始标志的bigram开始,我们先有一个( ...
- JS 获取指定日期的前几天,后几天
function getNextDate(date,day) { var dd = new Date(date); dd.setDate(dd.getDate() + day); var y = dd ...
- 对于char *s1 和 char s2[] 的认识
对于char *s1 和 char s2[] 认识有误区(认为无区别),导致有时出现“难以理解”的错误. char *s1 = "hello"; char s2[] = " ...
- 获取所有权windows目录所有权
Takeown /r /f 盘符:\目录\目录 例如: Takeown /r /f C:\Windows\CSC
- Json.Net 中Linq to JSON的操作
Linq to JSON是用来操作JSON对象的.可以用于快速查询,修改和创建JSON对象.当JSON对象内容比较复杂,而我们仅仅需要其中的一小部分数据时,可以考虑使用Linq to JSON来读取和 ...