3-6环形序列(Circular Sequence,AMC/ICPC Seoul 2004, UVa1584

#include
#include
using namespace std;
int main()
{
 int T;
 cin >> T;
 while (T-- > 0)
 {
  string org;
  cin >> org;
  int n = org.size();
  string smallest = org;
  for (int i = 1; i < n; ++i)
  {
   string temp(&org[i], &org[n - 1] + 1);
   temp.append(&org[0], &org[i]);
   if (smallest > temp)
    smallest = temp;
  }
  cout << smallest << endl;
 }
}

相关文章:

  • 2021-06-09
  • 2021-10-08
  • 2021-06-03
  • 2022-12-23
  • 2021-05-19
  • 2022-01-03
  • 2021-07-11
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-08
  • 2021-12-21
  • 2022-12-23
相关资源
相似解决方案