深信服 --测试岗 9.21

十道单选,十道问答,两道智力题,四道程序题  

 

深信服 --测试岗 9.21_第1张图片深信服 --测试岗 9.21_第2张图片

# include 
int main()
{
	int n;
	while (scanf_s("%d", &n) != EOF&&n)
		printf("%d\n", n&(-n));
	getchar();
	return 0;
}


 

深信服 --测试岗 9.21_第3张图片深信服 --测试岗 9.21_第4张图片

#include 
#include 
#include   
#include 
using namespace std;

int main()
{
	string source;
	string out_string = "";
	map   temp1;
	string temp;
	getline(cin, source);
	long long  index = 0;
	long long   count = 0;
	long long   inindex;
	for (int i = 0; i < source.length(); ++i)
	{
		if (!(source[i] >= 'a' && source[i] <= 'z'))

		{
			cout << 0 << endl;
			return 0;

		}
	}

	while (index < source.length())
	{
		inindex = index;
		count = 1;
		temp = "";
		temp = temp + source[index];
		while (inindex + 1 < source.length() && source[inindex + 1] == source[inindex])
		{
			temp = temp + source[index];
			count++;
			inindex++;
		}

		if (temp1.find(temp) != temp1.end())
		{
			temp1[temp] += 1;
		}
		else
		{
			if (out_string == "")
				out_string = to_string(count) + source[index];
			else
				out_string = out_string + " " + to_string(count) + source[index];

			temp1[temp] = 1;
		}


		index = inindex + 1;
	}

	cout << out_string << endl;

	return 0;
}

 

深信服 --测试岗 9.21_第5张图片

#include
#include
#include    

using namespace std;

int  main()
{
	int n;
	map record;
	int num;
	while (cin.peek() != '\n' && cin.peek() != EOF)
	{
		cin >> num;
		if (record.find(num) != record.end())
			record[num] += 1;
		else record[num] = 1;
	}

	map::iterator iter;
	iter = record.begin();
	int ans = 0;
	while (iter != record.end())
	{
		if (iter->second == 1)
			ans++;
		iter++;
	}
	cout << ans << endl;
	//system("pause");
	return 0;
}

你可能感兴趣的:(b笔试题,工作)