随笔分类 - 4.2散列
摘要:hash题。。。 #include<iostream> #include<algorithm> using namespace std; int hashtable[100500]= {0}; int c[100500] = {0}; int main() { int n,a,b,m; cin>>n
阅读全文
摘要:水题,hash题。 #include<iostream> #include<cmath> using namespace std; int hashtable[10000] = {0}; bool isPrime(int n) { //判断是否是素数 if(n <= 1) return false;
阅读全文
摘要:水题,hash题。 #include<iostream> #include<unordered_map> using namespace std; int main() { int n,queNum,memNum,score,MAX = -1,index = -1; unordered_map<in
阅读全文
摘要:水题。还是一道hash题。 #include<iostream> using namespace std; int main() { int map[128] = {0}; char c; while (scanf("%c",&c) != EOF) map[c]++; while (map['P']
阅读全文
摘要:水题,又是一道hash题。 #include<iostream> #include<cctype> using namespace std; int hashtable[26]= {0}; int main() { char c; while(scanf("%c",&c)!=EOF) { if(is
阅读全文
摘要:水题。发现PAT考察hash很多。 #include<iostream> #include<unordered_map> using namespace std; struct Student { string id;//学号 int sitNum;//考试座位号 }; int main() { i
阅读全文
摘要:较水。 #include<iostream> using namespace std; int hashtable1[300] = {0},hashtable2[300]= {0}; int main() { string str1,str2; cin>>str1>>str2; for(int i
阅读全文
摘要:水题。 #include<iostream> using namespace std; int hashtable[111]= {0}; //成绩与人数的映射 int main() { int n,score,k; cin>>n; for(int i = 0; i < n; ++i) { scanf
阅读全文
摘要:注意点: 一,下划线 _(代表空格),接收输入是真的空格,所以要用getline接收一行输入。 二,判断大写字母能否输出,必须同时上档键+和小写字母的键都未坏。 #include<iostream> #include<cctype> using namespace std; string str1,
阅读全文
摘要:水题。 #include<iostream> using namespace std; int a[100010]= {0}; int main() { int n,num,score,max = -1,pos = -1; cin>>n; for(int i = 0; i < n; ++i) { c
阅读全文
摘要:注意点: 一,加权求和表示,每一位乘以该位的权值最后求和,只对前17位加权求和。 新学一招,整型到字符的hash。 string hashtable = "10X98765432"; #include<iostream> #include<cctype> using namespace std; s
阅读全文
摘要:水题。与B1093 字符串A+B 类似。 #include<iostream> #include<cctype> using namespace std; bool hashtable[300] = {false}; int main() { string str1,str2; cin>>str1>
阅读全文
摘要:#include"iostream" #include"vector" #include"algorithm" using namespace std; bool hashtable[20000] = {false}; //因为待映射的值可能比较大,所以数组开大一点,不然最后两个测试点会出现 段错误
阅读全文

浙公网安备 33010602011771号