思路:

直接比较橘色框里的取第一次相等,即可。

#include<iostream>
#include<string>
using namespace std; string x, y;
int n, m, k; int main(){
cin>>n>>m;
cin>>x;
for(int i=;i<n;++i){
if(x.substr(i, n)==x.substr(, n-i)){y=x.substr(n-i, n); k=; break;}
}
if(k){
cout<<x;
for(int i=;i<m-;++i)
cout<<y;
cout<<endl;
}else{
for(int i=;i<m;++i)
cout<<x;
cout<<endl;
}
}

A. Many Equal Substrings(水题)的更多相关文章

  1. Codeforces Round #306 (Div. 2) A. Two Substrings 水题

    A. Two Substrings Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/550/pro ...

  2. Codeforces Round #258 (Div. 2) D. Count Good Substrings 水题

    D. Count Good Substrings 题目连接: http://codeforces.com/contest/451/problem/D Description We call a str ...

  3. Educational Codeforces Round 2 B. Queries about less or equal elements 水题

    B. Queries about less or equal elements Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforc ...

  4. 水题 Codeforces Round #306 (Div. 2) A. Two Substrings

    题目传送门 /* 水题:遍历一边先找AB,再BA,再遍历一边先找BA,再AB,两种情况满足一种就YES */ #include <cstdio> #include <iostream ...

  5. CF451C Predict Outcome of the Game 水题

    Codeforces Round #258 (Div. 2) Predict Outcome of the Game C. Predict Outcome of the Game time limit ...

  6. Codeforces Round #356 (Div. 2)B. Bear and Finding Criminals(水题)

    B. Bear and Finding Criminals time limit per test 2 seconds memory limit per test 256 megabytes inpu ...

  7. codeforces 677A A. Vanya and Fence(水题)

    题目链接: A. Vanya and Fence time limit per test 1 second memory limit per test 256 megabytes input stan ...

  8. Codeforces Round #334 (Div. 2) A. Uncowed Forces 水题

    A. Uncowed Forces Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/604/pro ...

  9. HDU 5538 L - House Building 水题

    L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...

  10. poj1564 Sum It Up dfs水题

    题目描述: Description Given a specified total t and a list of n integers, find all distinct sums using n ...

随机推荐

  1. Android中一张图片占据的内存大小是如何计算

    本篇文章已授权微信公众号 hongyangAndroid (鸿洋)独家发布 最近封装了个高斯模糊组件,正好将图片相关的理论基础也梳理了下,所以,这次就来讲讲,在 Android 中,怎么计算一张图片在 ...

  2. GDPR 和个人信息保护的小知识

    从2018年5月25日起,欧盟的<通用数据保护条例>(简称 GDPR,General Data Protection Regulation)开始强制施行.这个规范加强了对个人信息的保护,并 ...

  3. Testlink1.9.17使用方法(第七章 测试用例集管理)

    第七章 测试用例集管理 QQ交流群:585499566 测试用例准备好以后,可以对测试用例集进行相关的操作. 一. 添加测试用例到测试计划中 在主页的“当前测试计划”下拉列表里-->选择一个测试 ...

  4. vue缓存页面

    vue如何和ionic的缓存机制一样,可以缓存页面,在A页面跳转至B页面后返回A页面时A页面的数据还在? 在app.vue中将router-view使用keep-alive包起来,使用v-if来判断使 ...

  5. PyCharm 使用Github管理Django项目

    不管是对于教程代码免费分享的需要,还是项目开发过程中的版本管理,Github都是我们首选的开源代码仓库,如果你没有私有仓库,并且不用保护代码,那么将项目上传到Github上是最佳的选择. 关于如何使用 ...

  6. 智能POS打印配置&常见问题FAQ 12-14 后期持续更新

    1.安卓一体机会员注销钱会不会退回到支付宝 智能pos会员注销钱目前只能现金退还. 2.支付异常订单悬浮球在哪关闭 设置-->功能设置-->系统设置-->开启支付异常订单悬浮球 3. ...

  7. java.lang.IllegalStateException: Cannot forward after response has been committed的一个情况解决方法

    java.lang.IllegalStateException: Cannot forward after response has been committed xxx.xxx.doPost(upd ...

  8. C#-判断语句(五)

    判断语句主要有if...else.switch和 条件?语句1:语句2 三种,而if...else中又有if语句,if...else.if...else if...else和if中嵌套if这几种,但是 ...

  9. Android 模块构建错误不能下载依赖包

    在模块的build.gradle里面添加了 implementation 'com.android.support:design:26.1.0' 构建的时候一直报这个错 Unable to resol ...

  10. Linux进程启动过程分析do_execve(可执行程序的加载和运行)---Linux进程的管理与调度(十一)

    execve系统调用 execve系统调用 我们前面提到了, fork, vfork等复制出来的进程是父进程的一个副本, 那么如何我们想加载新的程序, 可以通过execve来加载和启动新的程序. x8 ...