记录编号 | 58640 | 评测结果 | AAAAAAAAAA | ||
---|---|---|---|---|---|
题目名称 | BOB还是BBO | 最终得分 | 100 | ||
用户昵称 | 是否通过 | 通过 | |||
代码语言 | C++ | 运行时间 | 0.643 s | ||
提交时间 | 2013-04-24 10:34:37 | 内存使用 | 0.32 MiB | ||
#include<iostream> #include<cstdio> #include<string> using namespace std; const int MAXN = 10005; char tmp[MAXN]; int main() { freopen("bob.in","r",stdin); freopen("bob.out","w",stdout); int cas; scanf("%d",&cas); while(cas --) { scanf("%s", tmp); string str = tmp, ans = tmp; str += str; for(int i = 0; i < ans.length(); i ++) { if(str[i] <= ans[0]) { string sub = str.substr(i, ans.length()); if(sub < ans) ans = sub; } } printf("%s\n", ans.c_str()); } return 0; }