水题 Gym 100553K Knockout Racing
/*
题意:有若干个点在一个区间内来回移动,1m/s。
水题:n^2的复杂度能解决,注意时间可能大于一个周期,要取模
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std; typedef long long ll;
const int MAXN = 1e3 + ;
const int INF = 0x3f3f3f3f;
ll x[MAXN], y[MAXN];
struct Question
{
ll x, y, t;
}q[MAXN];
int ans[MAXN]; int main(void) //Gym 100553K Knockout Racing
{
// freopen ("K.in", "r", stdin);
freopen ("knockout.in", "r", stdin);
freopen ("knockout.out", "w", stdout); int n, m;
while (scanf ("%d%d", &n, &m) == )
{
for (int i=; i<=n; ++i) scanf ("%I64d%I64d", &x[i], &y[i]);
for (int i=; i<=m; ++i) scanf ("%I64d%I64d%I64d", &q[i].x, &q[i].y, &q[i].t);
for (int i=; i<=m; ++i)
{
int cnt = ;
for (int j=; j<=n; ++j)
{
ll d = q[i].t % ((y[j] - x[j]) * );
ll pos = x[j];
if (pos + d <= y[j]) pos += d;
else pos = y[j] - (d - (y[j] - x[j]));
if (q[i].x <= pos && pos <= q[i].y) cnt++;
}
ans[i] = cnt;
} for (int i=; i<=m; ++i) printf ("%d\n", ans[i]);
} return ;
}
水题 Gym 100553K Knockout Racing的更多相关文章
- Codeforces Gym 100531G Grave 水题
Problem G. Grave 题目连接: http://codeforces.com/gym/100531/attachments Description Gerard develops a Ha ...
- codeforces Gym 100187L L. Ministry of Truth 水题
L. Ministry of Truth Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/p ...
- Codeforces Gym 100286G Giant Screen 水题
Problem G.Giant ScreenTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/con ...
- UVaLive 6591 && Gym 100299L Bus (水题)
题意:略. 析:不解释,水题. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include < ...
- 【转】POJ百道水题列表
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...
- 每日一刷(2018多校水题+2016icpc水题)
11.9 线段树 http://acm.hdu.edu.cn/showproblem.php?pid=6315 求逆序对个数 http://acm.hdu.edu.cn/showproblem.php ...
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- ACM :漫漫上学路 -DP -水题
CSU 1772 漫漫上学路 Time Limit: 1000MS Memory Limit: 131072KB 64bit IO Format: %lld & %llu Submit ...
- ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)
1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 154 Solved: 112[ ...
随机推荐
- 主成分分析(principal components analysis)
http://www.cnblogs.com/jerrylead/tag/Machine%20Learning/ PCA的思想是将n维特征映射到k维上(k<n),这k维是全新的正交特征.这k维特 ...
- Bag-of-words模型、TF-IDF模型
Bag-of-words model (BoW model) 最早出现在NLP和IR(information retrieval)领域. 该模型忽略掉文本的语法和语序, 用一组无序的单词(words) ...
- 【 D3.js 进阶系列 — 1.0 】 CSV 表格文件的读取
在入门系列的教程中.我们经常使用 d3.json() 函数来读取 json 格式的文件.json 格式非常强大.但对于普通用户可能不太适合,普通用户更喜欢的是用 Microsoft Excel 或 O ...
- redux-saga 异步流
前言 React的作用View层次的前端框架,自然少不了很多中间件(Redux Middleware)做数据处理, 而redux-saga就是其中之一,目前这个中间件在网上的资料还是比较少,估计应用的 ...
- ZOJ 3228 Searching the String (AC自己主动机)
题目链接:Searching the String 解析:给一个长串.给n个不同种类的短串.问分别在能重叠下或者不能重叠下短串在长串中出现的次数. 能重叠的已经是最简单的AC自己主动机模板题了. 不能 ...
- 积跬步,聚小流------Bootstrap学习记录(3)
响应式作为Bootstrap的一大特色.栅格系统可谓是功不可没,既然如此,那我们就来看一下栅格系统是怎样帮助bootstrap实现响应式布局的呢? 1.什么是栅格系统 我们能够从Bootstrap的官 ...
- [IT学习]从网上获取pdf制作vce文件
考过IT证书的朋友,都知道什么是vce文件.如果仅仅找到了pdf版本的文件,该如何转为vce文件呢? 具体的步骤如下: 1.到如下网址下载examformatter,http://www.examco ...
- VS2010打开高版本VS解决方案
http://blog.csdn.net/backspace110/article/details/62111273 Microsoft Visual Studio Solution File, Fo ...
- Installation error: INSTALL_FAILED_CPU_ABI_INCOMPATIBLE
解决方法: http://my.oschina.net/u/242764/blog/375909 当我们安装好Genymotion后,把Android运用部署到上面调试时,console 控制台会报错 ...
- 几个最短路径算法Floyd、Dijkstra、Bellman-Ford、SPFA的比较(转)
几大最短路径算法比较 几个最短路径算法的比较:Floyd 求多源.无负权边(此处错误?应该可以有负权边)的最短路.用矩阵记录图.时效性较差,时间复杂度O(V^3). Floy ...