NewOJ 1480: [蓝桥杯2019初赛]不同子串(set、string)

题目链接:点击这里

在这里插入图片描述
填空题。

#include<iostream>
#include<algorithm>
#include<string>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;
typedef long long ll;
const int MOD = 10000007;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int maxn = 200010;

int main()
{
	set<string> st;
	string s = "0100110001010001";
	int len = s.length();
	for(int i = 0; i < len; ++i)
	{
		for(int j = 1; j <= len; ++j)
		{
			st.insert(s.substr(i,j));
		}
	}
	
	printf("%d\n", st.size());		//100
	return 0;
}
发布了748 篇原创文章 · 获赞 113 · 访问量 13万+

猜你喜欢

转载自blog.csdn.net/qq_42815188/article/details/104500810