题目传送门

 /*
字符串处理:回文串是串联的,一个一个判断
*/
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std; const int MAXN = 1e3 + ;
const int INF = 0x3f3f3f3f;
char s[MAXN]; bool check(int x, int y)
{
for (int i=x, j=y; i<j; ++i, --j)
{
if (s[i] != s[j]) return false;
} return true;
} int main(void) //Codeforces Round #305 (Div. 2) A. Mike and Fax
{
int k;
while (scanf ("%s", s) == )
{
scanf ("%d", &k);
int len = strlen (s);
if (len % k != ) puts ("NO");
else if (len == && k == ) puts ("YES");
else
{
int m = len / k; bool flag = true;
for (int i=; i<len; i+=m)
{
if (!check (i, i+m-))
{
flag = false; break;
}
}
if (flag) puts ("YES");
else puts ("NO");
}
} return ;
}

字符串处理 Codeforces Round #305 (Div. 2) A. Mike and Fax的更多相关文章

  1. Codeforces Round #305 (Div. 2) A. Mike and Fax 暴力回文串

     A. Mike and Fax Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/548/pro ...

  2. set+线段树 Codeforces Round #305 (Div. 2) D. Mike and Feet

    题目传送门 /* 题意:对于长度为x的子序列,每个序列存放为最小值,输出长度为x的子序列的最大值 set+线段树:线段树每个结点存放长度为rt的最大值,更新:先升序排序,逐个添加到set中 查找左右相 ...

  3. 数论/暴力 Codeforces Round #305 (Div. 2) C. Mike and Frog

    题目传送门 /* 数论/暴力:找出第一次到a1,a2的次数,再找到完整周期p1,p2,然后以2*m为范围 t1,t2为各自起点开始“赛跑”,谁落后谁加一个周期,等到t1 == t2结束 详细解释:ht ...

  4. 暴力 Codeforces Round #305 (Div. 2) B. Mike and Fun

    题目传送门 /* 暴力:每次更新该行的num[],然后暴力找出最优解就可以了:) */ #include <cstdio> #include <cstring> #includ ...

  5. Codeforces Round #305 (Div. 2) B. Mike and Fun 暴力

     B. Mike and Fun Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/548/pro ...

  6. Codeforces Round #305 (Div. 1) B. Mike and Feet 单调栈

    B. Mike and Feet Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/547/pro ...

  7. Codeforces Round #305 (Div. 1) A. Mike and Frog 暴力

     A. Mike and Frog Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/547/pr ...

  8. Codeforces Round #305 (Div. 2)D. Mike and Feet(单调栈)

    题意 n个值代表n个熊的高度 对于size为x的group strength值为这个group(连续的几个熊)中熊的最小的height值 对于x(1<=x<=n) 求出最大的strengt ...

  9. Codeforces Round #305 (Div. 2) D. Mike and Feet 单调栈

    D. Mike and Feet time limit per test 1 second memory limit per test 256 megabytes input standard inp ...

随机推荐

  1. Gym - 101164C - Castle KMP

    题目链接:传送门 题解: 利用KMP的fail失配数组,快速找到当前后缀与前缀的公共前缀点 #include<bits/stdc++.h> using namespace std; #pr ...

  2. 新手必备的SEO优化工具

  3. python 1: 解决linux系统下python中的matplotlib模块内的pyplot输出图片不能显示中文的问题

    问题: 我在ubuntu14.04下用python中的matplotlib模块内的pyplot输出图片不能显示中文,怎么解决呢? 解决: 1.指定默认编码为UTF-8: 在python代码开头加入如下 ...

  4. STM32 DMA中断只进入一次的解决办法

    问题解决参见:http://bbs.ednchina.com/BLOG_ARTICLE_3014819.HTM 经过我验证,这个说的是对的.

  5. RestClient写法

    response = RestClient::Request.execute(:method=>:post, :url=> “http×××××”, :payload=>{:id=& ...

  6. ruby require

    require一般用来加载其它的类,如:  #Ruby代码  : require 'dbi'   require "rexml/document" 但是上面加载的是标准类库里面的文 ...

  7. C语言一个单链表的实现

    -- 所谓链表记住一句即可:地址不连续,大家只是握个手而已: list0.c #include<stdio.h> #include<malloc.h> typedef int ...

  8. Oracle:imp导入imp-00000问题

    现场环境:window2008 . oracle11.2g  .客户端安装的是oracle10g一个简洁版 34M的. 在imp导入时,提示 Message 100 not found; No mes ...

  9. 给jenkins设置管理员

    1.点击jenkins web 页的Manage Jenkins,然后点击 Configre Global Security,进行安全配置: 2.启用安全设置,使用Jenkins 自带数据库,只允许登 ...

  10. bzoj3198

    容斥原理+哈希表 恰好k个,那么上容斥原理,我们先2^6枚举相同的位置,用哈希表判断有多少个对应位置相同的元素,然后用容斥原理计算,似乎这里的容斥没有那么简单,详见这里 http://www.cnbl ...