CodeForces - 586D Phillip and Trains】的更多相关文章

D. Phillip and Trains time limit per test: 1 second memory limit per test :256 megabytes input: standard input output :standard output The mobile application store has a new game called "Subway Roller". The protagonist of the game Philip is loca…
题目链接 Phillip and Trains 考虑相对位移. 每一轮人向右移动一格,再在竖直方向上移动0~1格,列车再向左移动两格. 这个过程相当于每一轮人向右移动一格,再在竖直方向上移动0~1格,然后人再向右移动两格. 然后就可以进行状态转移了. f[i][j]表示能否走到i行j列的位置.最后在终点处查找是否存在f[i][ed]为1即可. #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i(a…
http://codeforces.com/problemset/problem/586/D 题意:有一个3*n(n<100)的隧道.一个人在最左边,要走到最右边,每次他先向右移动一格,再上下移动一格.隧道里有车,每次人移动以后,车会向右移动两格,人与车轮流运动. 题解,将每次车的移动变成人往右移动两格,然后就能搜索了.dfs,用vis数组判掉已经移动到的格子(因为已经移动到的格子要么是不能走到底的,要么就可以走完).注意他只能移动到三的倍数的格子,所以读入map后要再后面加两列'.' #def…
这道题是一道搜索题 但是 如果没有读懂或者 或者拐过弯 就很麻烦 最多26个火车 那么每一个周期 (人走一次 车走一次) 就要更改地图 的状态 而且操作复杂 容易超时 出错 利用相对运动 计周期为 人向上或向下或不动一步 + 向右三步 这样就变为走迷宫问题了 同样要注意 1.去重数组 或者 将以前访问过的点置为其他符号 避免重复访问 2.还有 因为 每次是三步三步的往右走 所以最后的边界可能不够 可以再扩充三列 #include <iostream> #include <stdio.h&…
D. Phillip and Trains Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/586/problem/D Description The mobile application store has a new game called "Subway Roller". The protagonist of the game Philip is located in one en…
/* CF586D. Phillip and Trains http://codeforces.com/problemset/problem/586/D 搜索 */ #include<cstdio> #include<algorithm> #include<string.h> using namespace std; ; ][Nmax]; ][Nmax]; int n,k; int t,ans; int dfs(int step,int pos) { &&…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output The mobile application store has a new game called "Subway Roller". The protagonist of the game Philip is located in one end of the tunnel a…
原题连接:http://codeforces.com/contest/586/problem/D 题意: 就大家都玩过地铁奔跑这个游戏(我没玩过),然后给你个当前的地铁的状况,让你判断人是否能够出去. 题解: 就首先预处理一下每个点在哪些时刻会被车子占领,然后从右向左dp一下就好 代码: #include<iostream> #include<cstring> #include<string> #include<vector> #include<alg…
The mobile application store has a new game called "Subway Roller". The protagonist of the game Philip is located in one end of the tunnel and wants to get out of the other one. The tunnel is a rectangular field consisting of three rows and n co…
题意: s是这个人开始位置:连续相同大写字母是 Each of the k trains,相应的火车具有相应的字母: '.' 代表空: 有个人在最左列,上面有连续字母代表的火车,火车从左边出去的话,会从右边继续进来, 一开始是人先往右走一步,然后上下或者一步,然后火车往左移两步. n有100,代表长度,k代表火车的数量: 思路: BFS; 走完还要再走两个= =.妈个鸡啊. 一开始一直踏马地觉得没必要BFS,没必要BFS...后面搞懂了之前比赛中的思路是递推,也就是DP,但是踏马的DP递推真的写…