深信服 --测试岗 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;
}