简易字符串匹配,题意不难

 #include <stdio.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>
using namespace std; int main(){
int i, j, k, t, n;
int num, flag, ans;
char a[];
scanf("%s",a);
scanf("%d",&k);
int len = strlen(a);
num = len + k;
num /= ;
flag = ;
for(n = num; n > ; --n){
for(j = ; j < len; ++j){
i = j;
while(i < j + n && i <(len + k - n)){
if((i + n) >= len){
++i;
continue;
}
if(a[i] == a[i + n]){
++i;
continue;
}
else break;
} if(i == j + n){
flag = ;
break;
}
}
if(flag) break;
}
printf("%d\n",n * );
return ;
}

Codeforces Round #253 (Div. 2), problem: (B)【字符串匹配】的更多相关文章

  1. Codeforces Round 253 (Div. 2)

    layout: post title: Codeforces Round 253 (Div. 2) author: "luowentaoaa" catalog: true tags ...

  2. Codeforces Round #253 (Div. 1) (A, B, C)

    Codeforces Round #253 (Div. 1) 题目链接 A:给定一些牌,然后如今要提示一些牌的信息,要求提示最少,使得全部牌能够被分辨出来. 思路:一共2^10种情况,直接暴力枚举,然 ...

  3. Codeforces Round #716 (Div. 2), problem: (B) AND 0, Sum Big位运算思维

    & -- 位运算之一,有0则0 原题链接 Problem - 1514B - Codeforces 题目 Example input 2 2 2 100000 20 output 4 2267 ...

  4. Codeforces Round #753 (Div. 3), problem: (D) Blue-Red Permutation

    还是看大佬的题解吧 CFRound#753(Div.3)A-E(后面的今天明天之内补) - 知乎 (zhihu.com) 传送门  Problem - D - Codeforces 题意 n个数字,n ...

  5. Codeforces Round #253 (Div. 2) D. Andrey and Problem

    关于证明可以参考题解http://codeforces.com/blog/entry/12739 就是将概率从大到小排序然后,然后从大到小计算概率 #include <iostream> ...

  6. Codeforces Round #253 (Div. 1) B. Andrey and Problem

    B. Andrey and Problem time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  7. Codeforces Round #425 (Div. 2) Problem B Petya and Exam (Codeforces 832B) - 暴力

    It's hard times now. Today Petya needs to score 100 points on Informatics exam. The tasks seem easy ...

  8. Codeforces Round #253 (Div. 1) A. Borya and Hanabi 暴力

    A. Borya and Hanabi Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/442/p ...

  9. Codeforces Round #243 (Div. 2) Problem B - Sereja and Mirroring 解读

    http://codeforces.com/contest/426/problem/B 对称标题的意思大概是.应当指出的,当线数为奇数时,答案是线路本身的数 #include<iostream& ...

随机推荐

  1. 解决windows7搜索不了txt文本内容的问题

    windows7默认的搜索框是只搜索文件名,若是要文件内容的话,需要这样设置: 打开"我的电脑",左上角"组织"→"文件夹和搜索选项"→&q ...

  2. [LeetCode]题解(python):126-Word Ladder II

    题目来源: https://leetcode.com/problems/word-ladder-ii/ 题意分析: 给定一个beginWord和一个endWord,以及一个字典单词,找出所有从begi ...

  3. squid客户端命令

    常用squid客户端命令: squidclient -p mgr:info #取得squid运行状态信息: squidclient -p mgr:mem #取得squid内存使用情况: squidcl ...

  4. 程序员眼中的UML

    --克服用例图的恐惧 在实际工作中,大部分程序员很少接触到需求分析,即使有需求分析,也是草草了事,没有用正规的方式来表达,所以一般程序员使用用例图的机会是不多的.但是却又常常在各种媒体上看见用例图,于 ...

  5. Dojo baseurl

    dojo.baseUrl baseUrl用来存储dojo.js存放 的跟目录,例如dojo.js的路径是“/web/scripts/dojo-1.3/dojo/dojo.js”则baseUrl为“/w ...

  6. eclipse修改java代码后报错: java.lang.OutOfMemoryError: PermGen space

    由于在eclipse中运行项目后,我们又重新修改了某个java类,导致tomcat会重新加载这个项目所有的class.jar,多次加载后由于分配的存储空间有限,就导致了:java.lang.OutOf ...

  7. MVC DI

    using System;using Microsoft.Practices.Unity; public class BizInstanceFactory { private static reado ...

  8. BZOJ 1609: [Usaco2008 Feb]Eating Together麻烦的聚餐( LIS )

    求LIS , 然后用 n 减去即为answer ---------------------------------------------------------------------------- ...

  9. Active MQ C#实现

    原文链接: Active MQ C#实现 内容概要 主要以源码的形式介绍如何用C#实现同Active MQ 的通讯.本文假设你已经正确安装JDK1.6.x,了解Active MQ并有一定的编程基础. ...

  10. Sort list by merge sort

    使用归并排序对链表进行排序 O(nlgn) 的时间效率 /** * Definition for singly-linked list. * struct ListNode { * int val; ...