'commit'
This commit is contained in:
34
GESP/Level4/GESP202412/2.cpp
Normal file
34
GESP/Level4/GESP202412/2.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
const int N = 110;
|
||||
string s[N];
|
||||
int main() {
|
||||
// 从文本文件中获取输入
|
||||
#ifndef ONLINE_JUDGE
|
||||
freopen("4.in", "r", stdin);
|
||||
#endif
|
||||
int T;
|
||||
cin >> T;
|
||||
while (T--) {
|
||||
int n;
|
||||
cin >> n;
|
||||
for (int i = 1; i <= n; i++)
|
||||
cin >> s[i];
|
||||
// 对字符串进行排序
|
||||
sort(s + 1, s + n + 1);
|
||||
// 拼接成一个长的字符串
|
||||
string t = "";
|
||||
for (int i = 1; i <= n; i++)
|
||||
t = t + s[i];
|
||||
|
||||
bool isHeFa = true;
|
||||
for (int i = 1; i < t.size(); i++) {
|
||||
if (t[i] < t[i - 1]) {
|
||||
isHeFa = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
cout << isHeFa << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user