题目传送门

 /*
字符串处理:回文串是串联的,一个一个判断
*/
#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. Windows 8实用窍门系列:20.Windows 8中的GridView使用(二)和DataTemplateSelector

    在本文中所讲述内容的实例仍然沿用于上篇文章,有什么疑惑可以参考上篇文章. 一 GroupStyle 在GridView控件中我们可以对数据进行分组显示,通过对GridView的GroupStyle进行 ...

  2. sendmessage传递数组

    1.在初始化数组尤其是需要每次都初始化的时候,很多同学使用循环来进行,这样不但速度慢,而且写起来也很长.所以现在提供一个函数来实现这个功能... 原型:extern void *memset(void ...

  3. C++虚复制构造函数,设置Clone()方法返回基类指针,并设置为虚函数

    构造函数不能是虚函数.但有时候确实需要能传递一个指向基类对象的指针,并且有已创建的派生类对象的拷贝.通常在类内部创建一个Clone()方法,并设置为虚函数. //Listing 12.11 Virtu ...

  4. ajax访问json文件缓存问题

    ajax访问json文件,json文件改动,访问的时候也不能及时看到改动后的内容. 这是因为浏览器缓存的原因. 在这时候就需要清除浏览器的缓存或者加上一个标记,让ajax访问文件的时候知道这是一个新的 ...

  5. 关于ie6 下背景图片不透明以及Img不透明

    ie6 下背景图片不透明的方法,加上下面的js即可解决 //解决IE6下图片不透明 function correctPNG() // correctly handle PNG transparency ...

  6. aop+自定义注解

    自定义注解,并且实现,需要两个文件: 自定义注解类: package com.clc.server.annotation; import java.lang.annotation.ElementTyp ...

  7. 一步一步学Silverlight 2系列(12):数据与通信之WebClient

    概述 Silverlight 2 Beta 1版本发布了,无论从Runtime还是Tools都给我们带来了很多的惊喜,如支持框架语言Visual Basic, Visual C#, IronRuby, ...

  8. 【Codeforces 20C】 Dijkstra?

    [题目链接] 点击打开链接 [算法] dijkstra [代码] #include<bits/stdc++.h> using namespace std; typedef long lon ...

  9. B. Mishka and trip

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  10. 【社群话题分享】LAMP 还是 LNMP 或者 ?

    每周三下午的话题活动是又拍云技术社群的优良传统- 大家一起来看看这周都聊了些啥吧- 往期话题推荐: [社群话题分享]Linux 各大发行版你怎么选? [社群话题分享]数据权限该怎么放? [社群话题分享 ...