ZeptoLab Code Rush 2015 A. King of Thieves 暴力
A. King of Thieves
Time Limit: 1 Sec Memory Limit: 256 MB
题目连接
http://codeforces.com/contest/526/problem/A
Description
In this problem you will meet the simplified model of game King of Thieves.
In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character, avoiding traps and obstacles on your way.
An interesting feature of the game is that you can design your own levels that will be available to other players. Let's consider the following simple design of a level.
A dungeon consists of n segments located at a same vertical level, each segment is either a platform that character can stand on, or a pit with a trap that makes player lose if he falls into it. All segments have the same length, platforms on the scheme of the level are represented as '*' and pits are represented as '.'.
One of things that affects speedrun characteristics of the level is a possibility to perform a series of consecutive jumps of the same length. More formally, when the character is on the platform number i1, he can make a sequence of jumps through the platforms i1 < i2 < ... < ik, if i2 - i1 = i3 - i2 = ... = ik - ik - 1. Of course, all segments i1, i2, ... ik should be exactly the platforms, not pits.
Let's call a level to be good if you can perform a sequence of four jumps of the same length or in the other words there must be a sequence i1, i2, ..., i5, consisting of five platforms so that the intervals between consecutive platforms are of the same length. Given the scheme of the level, check if it is good.
Input
The first line contains integer n (1 ≤ n ≤ 100) — the number of segments on the level.
Next line contains the scheme of the level represented as a string of n characters '*' and '.'.
Output
Sample Input
16
.**.*..*.***.**.
Sample Output
HINT
题意
让你选个起点,然后跳四下长度一样的,问你能否都跳到*上
题解:
啊,直接暴力就行了
代码:
//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 200001
#define mod 10007
#define eps 1e-9
//const int inf=0x7fffffff; //无限大
const int inf=0x3f3f3f3f;
/*
inline ll read()
{
int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
int buf[10];
inline void write(int i) {
int p = 0;if(i == 0) p++;
else while(i) {buf[p++] = i % 10;i /= 10;}
for(int j = p-1; j >=0; j--) putchar('0' + buf[j]);
printf("\n");
}
*/
//************************************************************************************** char s[];
int main()
{
int n;cin>>n;
scanf("%s",s+);
int flag=;
for(int i=;i<=n;i++)
{
for(int j=;j<=;j++)
{
if(s[i]=='*'&&s[i+j]=='*'&&s[i+*j]=='*'&&s[i+*j]=='*'&&s[i+*j]=='*')
{
cout<<"yes"<<endl;
return ;
}
}
}
cout<<"no"<<endl;
}
ZeptoLab Code Rush 2015 A. King of Thieves 暴力的更多相关文章
- CodeForces ZeptoLab Code Rush 2015
拖了好久的题解,想想还是补一下吧. A. King of Thieves 直接枚举起点和5个点之间的间距,进行判断即可. #include <bits/stdc++.h> using na ...
- ZeptoLab Code Rush 2015
A 题意:给出一串由.*组成的字符串,如果有等间距的五个及五个以上的*存在,则输出yes 直接枚举就可以了 看题一定要仔细啊,做的时候看成必须有五个等间距的".*"才可以跳跃= = ...
- Codeforces - ZeptoLab Code Rush 2015 - D. Om Nom and Necklace:字符串
D. Om Nom and Necklace time limit per test 1 second memory limit per test 256 megabytes input standa ...
- ZeptoLab Code Rush 2015 C. Om Nom and Candies 暴力
C. Om Nom and Candies Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/526 ...
- ZeptoLab Code Rush 2015 B. Om Nom and Dark Park DFS
B. Om Nom and Dark Park Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/5 ...
- Codeforces ZeptoLab Code Rush 2015 D.Om Nom and Necklace(kmp)
题目描述: 有一天,欧姆诺姆发现了一串长度为n的宝石串,上面有五颜六色的宝石.他决定摘取前面若干个宝石来做成一个漂亮的项链. 他对漂亮的项链是这样定义的,现在有一条项链S,当S=A+B+A+B+A+. ...
- ZeptoLab Code Rush 2015 C. Om Nom and Candies [ 数学 ]
传送门 C. Om Nom and Candies time limit per test 1 second memory limit per test 256 megabytes input sta ...
- ZeptoLab Code Rush 2015 B. Om Nom and Dark Park
Om Nom is the main character of a game "Cut the Rope". He is a bright little monster who l ...
- Code Rush插件
code rush 是微软推出的一款VS2008上的插件.他有强大的文件和代码导航功能,易于访问的重构和代码创建功能.一组编辑器.选择.剪贴板工具等. 教程链接 http://www.devexpre ...
随机推荐
- 【记录】尝试用QEMU模拟ARM开发板去加载并运行Uboot,kernel,rootfs【转】
转自:https://www.crifan.com/try_use_qemu_emulate_arm_board_to_load_and_run_uboot_kernel_rootfs/ [背景] 手 ...
- 3->集群架构主机克隆教程
centos7系统集群主机克隆: 有道笔记链接地址
- 03 Go 1.3 Release Notes
Go 1.3 Release Notes Introduction to Go 1.3 Changes to the supported operating systems and architect ...
- 01 Getting Started 开始
Getting Started 开始 Install the Go tools Test your installation Uninstalling Go Getting help Downlo ...
- Python [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed 解决方法
一个搭建在SAE上的Django应用,使用新浪微博提供的Python SDK已经稳定运行一年有余,但最近开始持续出现微博认证失败的状况. 摘录微博python SDK的错误提示如下所示: ERROR: ...
- AT994 【11の倍数】
超短AC代码压行小技巧 #include<iostream> using namespace std; string s; ]; int main() { cin>>s; in ...
- C++ 必须使用初始化列表
继承关系中,父类无默认构造函数 类类型类成员变量无默认构造函数 const类型成员变量 引用类型成员变量 不使用初始化列表,在创建对象调用构造函数之前会对所有的成员变量进行默认初始化,然后再执行构造函 ...
- 每位架构师都应该熟知的 10 个 SOA 设计模式
这 10 个 SOA 设计模式是如此之重要,其应用是如此之广泛,以至于它们都有些显而易见了. 1. 服务无关 服务无关实现对多种业务通用的逻辑.将服务无关的逻辑分离成离散的服务以方便服务的重用和整合. ...
- 容器计划任务大坑:在alpine容器里,想用非root帐号执行crontab任务
我只能说抱歉,我前前后后测试了七天, 将自己预想的配置错误,一个一个去验证. 非root帐号在alpine容器里执行crontab任务,还是失败, 输出依旧是一片空白~ stackoverflow里, ...
- sql server2014 企业版 百度云下载
sql server2014 企业版 百度云下载 链接: https://pan.baidu.com/s/1j7a6RWwpvSzG-sF7Dnexfw 提取码: 关注公众号[GitHubCN]回复获 ...