其他分享
首页 > 其他分享> > 【第一道水题】A. Two Subsequences

【第一道水题】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;
	}
}

​

 

 

标签:string,水题,int,ll,Two,long,cin,Subsequences
来源: https://blog.csdn.net/nathanqian123/article/details/120976248