C/C++教程

Educational Codeforces Round 121 (Rated for Div. 2) ABC(区间求并)

本文主要是介绍Educational Codeforces Round 121 (Rated for Div. 2) ABC(区间求并),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

A. Equidistant Letters

直接对原字符串进行排序,这样能保证相同的字母相邻,间隔为0.

#include <iostream>
#include <vector>
#include <algorithm>
#define pii pair<int,int>
#define fi first
#define se second
#define ll long long
using namespace std;
int main() {
	int t;
	cin >> t;
	while(t--) {
		string s;
		cin >> s;
		vector<char> v;
		for(auto x : s) v.push_back(x);
		sort(v.begin(), v.end());
		for(auto x : v) cout << x;
		cout << endl;
	}
	return 0;
}

B. Minor Reduction

You are given a decimal representation of an integer

这篇关于Educational Codeforces Round 121 (Rated for Div. 2) ABC(区间求并)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!