C++ 哈希
字符串字符匹配
http://www.nowcoder.com/questionTerminal/22fdeb9610ef426f9505e3ab60164c93
#include <bits/stdc++.h> using namespace std; int main(int argc, char* argv[]) { string str1, str2; int hashTable[300]; while(cin >> str1) { cin >> str2; memset(hashTable, 0, 300 * sizeof(int)); for(auto c : str1) { hashTable[c] = 1; } for(auto c : str2) { hashTable[c] = 0; } bool flag = true; for(auto c : str1) { if(hashTable[c]) { flag = false; break; } } if(flag) cout << "true" << endl; else cout << "false" << endl; } return 0; }