【第一道水题】A. Two Subsequences

题目来源:Problem - A - CodeforcesCodeforces. Programming competitions and contests, programming communityhttps://codeforces.com/contest/1602/problem/A

题干: 

第一道水题,结果被想复杂了。这个只需要将字符串进行排序,然后输出一个最小元素和一个缺少最小元素的字串即可

别人的源代码:

​#include<bits/stdc++.h>

#define  ll long long int
int main() {
	ll t;
	cin >> t;
	while (t--) {
		string s;
		cin >> s;
		string p = s;
		sort(p.begin(), p.end());
		cout << p[0] << " ";
		s.erase(s.begin() + s.find(p[0]));
		cout << s << endl;
	}
}

​

猜你喜欢

转载自blog.csdn.net/nathanqian123/article/details/120976248