G 最水的一道
G - Here Be Dragons
The Triwizard Tournament's third task is to negotiate a corridor of many segments, and reach the other end. The corridor is N segments long. The ith segment is either empty or has a dragon. Harry cannot pass the dragon and will have no option but to retreat if he encounters one. Is it possible for him to reach the exit starting from the entrance?
The Triwizard Tournament's third task is to negotiate a corridor of many segments, and reach the other end. The corridor is N segments long. The ith segment is either empty or has a dragon. Harry cannot pass the dragon and will have no option but to retreat if he encounters one. Is it possible for him to reach the exit starting from the entrance?
Input (STDIN):
The first line contains the number of test cases T.
Each of the next T lines contains a string describing the corridor. The ith character is either a '.' if the segment is empty, or a 'D' if the segment contains a dragon.
Output (STDOUT):
Output T lines, each containing either the string "Possible" if you can reach the exit, and "You shall not pass!" if it is not possible to reach the exit.
Constraints:
1 <= T <= 50
1 <= N <= 50
Sample Input:
3
..
..D.
D..D
Sample Output:
Possible
You shall not pass!
You shall not pass!
题意:D表示障碍 .表示可以通过 障碍不可以通过 问是否可以走过路线
#include <iostream>
#include <string.h>
#include <stdio.h> using namespace std; int main()
{
char a[];
int t;
bool OK;
scanf("%d",&t);
while(t--)
{
scanf("%s",&a);
OK=false;
int len=strlen(a);
for(int i=; i<len; i++)
{
if(a[i]=='D')
{
OK=true;
break;
}
}
if(OK)
printf("You shall not pass!\n");
else
printf("Possible\n");
}
return ;
}
G 最水的一道的更多相关文章
- SRM 584 第一次玩TopCoder。。。只水题一道。。。
		
第一次topcoder,以前老感觉没有资格去做tc,cf什么的,现在已经慢慢接触了. 感觉还可以,还是有让我们这些蒻菜安慰的水题. tc的确很好玩,用客户端比赛,还有各种规则,而且还是只编写一个类提交 ...
 - 【CodeForces 602B】G - 一般水的题2-Approximating a Constant Range
		
Description When Xellos was doing a practice course in university, he once had to measure the intens ...
 - hdu 5038 (2014北京网络赛G  排序水题)
		
题意:有n个数字,带入10000 - (100 - ai) ^ 2公式得到n个数,输出n个数中频率最大的数,如果有并列就按值从小到大都输出输出,如果频率相同的数字是全部的n个数,就输出Bad....题 ...
 - Argus UVALive - 3135(优先队列 水题一道)
		
有一系列的事件,它每Period秒钟就会产生编号为qNum的事件,你的任务是模拟出前k个事件,如果多个事件同时发生,先处理qNum小的事件 今天再看看数据结构.. #include <iostr ...
 - hdu 4464 水
		
http://acm.hdu.edu.cn/showproblem.php?pid=4464 现场赛总会有水题,这就是最水的一道,预计也就是能当高校的上机题,保研用,呵呵~~~ #include &l ...
 - CF330 C. Purification 认真想后就成水题了
		
C. Purification time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...
 - [題解](水)luogu_P1372又是畢業季1
		
被入門難度的題虐...... 作者: kkksc03 吉祥物 更新时间: 2013-07-14 19:00 在Ta的博客查看 78 By lzn 数论水题一道. 首先,若可能的最大公约数为a ...
 - [ZPG TEST 114] 阿狸的英文名【水题】
		
1. 阿狸的英文名 阿狸最近想起一个英文名,于是他在网上查了很多个名字.他发现一些名字可以由两个不同的名字各取一部分得来,例如John(约翰)的前缀 “John”和Robinson(鲁滨逊) ...
 - codeforces Gym 100735 D、E、G、H、I
		
http://codeforces.com/gym/100735 D题 直接暴力枚举 感觉这道题数据有点问题 为什么要先排下序才能过?不懂.. #include <stdio.h> #in ...
 
随机推荐
- 201621123008 《Java程序设计》第14周学习总结
			
1. 本周学习总结 1.1 以你喜欢的方式(思维导图或其他)归纳总结与数据库相关内容. 2. 使用数据库技术改造你的系统 2.1 简述如何使用数据库技术改造你的系统.要建立什么表?截图你的表设计. 分 ...
 - ASCII码表以及不同进制间的O(1)转换
			
ASCII码表以及不同进制间的O(1)转换 一.ASCII码表 ASCII全称为American Standard Code for Information Interchange, ...
 - maven3 学习
			
主要参考博文:http://www.cnblogs.com/yjmyzz/p/3495762.html 修正: 1.下载maven 3.1.1 先到官网http://maven.apache.org/ ...
 - [Hbase]Hbase章3 Hbase单点故障
			
很长一段时间以来,一个region同一时间只能在一台RS(Region Server)中打开.如果一个region同时在多个RS上打开,就是multi-assign问题,会导致数据不一致甚至丢数据的情 ...
 - 买茶叶想到的哪个比较便宜 x1/y1 >x2/y2     x代表多少钱 y代表 多少克 无聊的试炼
			
茶叶1 128元 200克 茶叶2 330元 160克 当然这个哪个便宜 一眼就知道了,这里不过抛砖引玉 128元 330元 200克 160克 我们把价钱用x表示 多少克 ...
 - maven打包之后为什么class文件中没有注释了?
			
<!--生成doc jar包--> <plugin> <groupId>org.apache.maven.plugins</groupId> <a ...
 - 利用PHP脚本辅助MySQL数据库管理2-表主键表索引
			
<?php $dbi = new DbMysql; $dbi->dbh = 'mysql://root:mysql@127.0.0.1/coffeetest'; $map = array( ...
 - 子数整数(P1151&NOIP水题测试(2017082301))
			
题目链接:子数整数 水题,不解释,自己看代码: #include<bits/stdc++.h> using namespace std; int main(){ int k; scanf( ...
 - Java第3章笔记
			
if基本语法: if(条件){// 表达式 // 代码块 } eg: int a = 10; if(a > 1){ System.out.println("内容& ...
 - java:static详解
			
1.static修饰的变量习惯称为静态变量,static修饰的方法称为静态方法,static修饰的代码块叫做静态代码块. 1)static变量 static变量也称作静态变量,静态变量和非静态变量的区 ...