深信服 --测试岗 9.21

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

 

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


 

#include <iostream>
#include <vector>
#include <string>  
#include <map>
using namespace std;

int main()
{
	string source;
	string out_string = "";
	map <string, int >  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;
}

 

#include<iostream>
#include<string>
#include <map>   

using namespace std;

int  main()
{
	int n;
	map<int, int > 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<int, int >::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;
}
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值