A. Many Equal Substrings(水题)
思路:
直接比较橘色框里的取第一次相等,即可。

#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(水题)的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 水题 Codeforces Round #306 (Div. 2) A. Two Substrings
题目传送门 /* 水题:遍历一边先找AB,再BA,再遍历一边先找BA,再AB,两种情况满足一种就YES */ #include <cstdio> #include <iostream ...
- CF451C Predict Outcome of the Game 水题
Codeforces Round #258 (Div. 2) Predict Outcome of the Game C. Predict Outcome of the Game time limit ...
- 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 ...
- codeforces 677A A. Vanya and Fence(水题)
题目链接: A. Vanya and Fence time limit per test 1 second memory limit per test 256 megabytes input stan ...
- 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 ...
- HDU 5538 L - House Building 水题
L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
- poj1564 Sum It Up dfs水题
题目描述: Description Given a specified total t and a list of n integers, find all distinct sums using n ...
随机推荐
- Go实现基于WebSocket的弹幕服务
拉模式和推模式 拉模式 1.数据更新频率低,则大多数请求是无效的 2.在线用户量多,则服务端的查询负载高 3.定时轮询拉取,实时性低 推模式 1.仅在数据更新时才需要推送 2.需要维护大量的在线长连接 ...
- Vue Document
目录 VUE笔记 环境搭建 Vue学习笔记 1.Vue指令 VUE笔记 环境搭建 node -v npm -v npm i -g cnpm --registry=https://registry.np ...
- SAP WM 有无保存WM Level历史库存的Table?
SAP WM 有无保存WM Level历史库存的Table? 前日下班回家的路上,收到一个前客户内部顾问同行发过来的微信,问我在SAP系统里哪个表是用来存储WM Level历史库存的. 这个问题问住了 ...
- 深度学习新星:GAN的基本原理、应用和走向
深度学习新星:GAN的基本原理.应用和走向 (本文转自雷锋网,转载已获取授权,未经允许禁止转载)原文链接:http://www.leiphone.com/news/201701/Kq6FvnjgbKK ...
- Java环境变量搭建
安装JDK开发环境 jdk下载地址:https://www.oracle.com/technetwork/java/javase/downloads/jdk10-downloads-4416644.h ...
- Linux Linux下最大文件描述符设置
Linux下最大文件描述符设置 by:授客 QQ:1033553122 1. 系统可打开最大文件描述符设置 查看系统可打开最大文件描述符 # cat /proc/sys/fs/file-max 6 ...
- slice()和subString()
substring() 方法用于提取字符串中介于两个指定下标之间的字符.slice()返回一个子片段,对原先的string没有影响,与subString的区别是,还可以用负数当参数,相当于是lengt ...
- NoHttp封装--08 用一个实体类接收所有接口数据
1.用户信息获取--bean实体类形式返回数据 ①服务器端: 代码: protected void onHandler(HttpServletRequest request, HttpServletR ...
- 淘宝开放平台使用WebClient,WebRequest访问时的错误提示导致麻烦
淘宝开放平台(TOP)提供OAuth2.0支持 通过C#的WebClient/WebRequest直接访问时会提示grant type is empty,这是一个非常恼人的错误,你会发现即使传了这个参 ...
- JS辨别访问浏览器判断是android还是ios系统
function isIOSOrAndroid() { var browser = { versions: function() { var u = navigator.userAgent, app ...