3-9 子序列 UVa 10340

#include 
#include 
#include 
using namespace std;

int main()
{
	string s, t;
	cin >> s >> t;
	int j = 0;
	int k = 0;
	for (int i = 0; i < (int)t.size(); i++)
	{
		for (; j < (int)s.size(); j++)
			if (t[i] == s[j])
			{
				k++;
				break;
			}
	}
	if (k == t.size())
		cout << 1 << endl;
	else
		cout << 0 << endl;

	return 0;
}

你可能感兴趣的:(C++,算法竞赛入门第三章习题)