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;
}
kgduu
+关注
目录
打赏
0
0
0
0
0
分享
相关文章
|
9月前
|
Regular Expression
【7月更文挑战第1天】
71 1
【欧拉计划第 12 题】 高度可除的三角数 Highly divisible triangular number
【欧拉计划第 12 题】 高度可除的三角数 Highly divisible triangular number
154 0
【欧拉计划第 12 题】 高度可除的三角数 Highly divisible triangular number
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.
141 0
Sarsa(λ) and Q(λ) in Tabular Case
‘Thanks R. S. Sutton and A. G. Barto for their great work in Reinforcement Learning: An Introduction. Eligibility Traces in Prediction Problems In the backward view of TD(λ)TD(\lambda), t
2455 0