UVa1584 - Circular Sequence

简介: UVa1584 - Circular Sequence
#include <iostream>#include <string>#include <fstream>#include <vector>#include <algorithm>usingnamespacestd;
voidsolve(strings);
intmain()
{
#ifndef ONLINE_JUDGEifstreamfin("d:\\OJ\\uva_in.txt");
streambuf*old=cin.rdbuf(fin.rdbuf());
#endifintt;
cin>>t;
while (t--) {
strings;
cin>>s;
solve(s);
    }
#ifndef ONLINE_JUDGEcin.rdbuf(old);
#endifreturn0;
}
voidsolve(strings)
{
vector<string>vStr;
vStr.push_back(s);
for (size_ti=1, len=s.length(); i<len; i++) {
stringtmp;
tmp.append(s, i, len-i);
tmp.append(s, 0, i);
vStr.push_back(tmp);
    }
sort(vStr.begin(), vStr.end());
cout<<vStr.front() <<endl;
}
目录
相关文章
|
6月前
|
Python
Regular Expression
【7月更文挑战第1天】
42 1
|
Java Unix Shell
Regular Expressions (9)
基于POSIX BRE & ERE
186 0
Regular Expressions (9)
Triangular Collection思维
题目描述 Call a set of positive integers triangular if it has size at least three and, for all triples of distinct integers from the set, a triangle with those three integers as side lengths can be constructed. Given a set of positive integers, compute the number of its triangular subsets.
126 0
AtCoder Regular Contest 069 D
D - Menagerie Time limit : 2sec / Memory limit : 256MB Score : 500 points Problem Statement Snuke, who loves animals, built a zoo.
1072 0
|
Web App开发 前端开发
glyphicon halflings regular ttf 报错
一个web项目 用了bootstrap chrome开f12报错提示glyphicon halflings regular ttf找不到 为什么找不到,肯定又是path出了问题 找到bootstrap.css 找到glyphicon的引用路径,是相对路径,改掉,KO
935 0
LeetCode - 10. Regular Expression Matching
10. Regular Expression Matching Problem's Link  ---------------------------------------------------------------------------- Mean:  给定一个串s和一个自动机p(模糊字符只含有'.
966 0
Regular Expression Matching
正则匹配 Regular Expression Matching Implement regular expression matching with support for '.' and '*'.
780 0