2016/12/8 1003. 简单哈希
来源:互联网 发布:端游发展史 知乎 编辑:程序博客网 时间:2024/06/14 18:21
原理不难,就是一个链表的建立而已。
// Problem#: 19854// Submission#: 4951626// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License// URI: http://creativecommons.org/licenses/by-nc-sa/3.0/// All Copyright reserved by Informatic Lab of Sun Yat-sen University#include <iostream>using namespace std;class Node{public: Node(int a=0) { data=a; next=NULL; } int data; Node* next; };int main(){ int n; for(;;) { cin >> n; if(!n)break; Node hash[13]; for(int i=0;i<n;i++) { int temp; cin >> temp; if(hash[temp%13].data==0) { hash[temp%13].next=new Node (temp); hash[temp%13].data=1; } else { Node*p=hash[temp%13].next; while(p->next!=NULL) { p=p->next; } p->next=new Node (temp); } } for(int i=0;i<13;i++) { if(hash[i].data==0) { cout << i << "#NULL" << endl; } else { cout << i << "#"; Node*p =hash[i].next; while(p->next!=NULL) { cout << p->data << " " ; p=p->next; } cout << p->data << endl ; } } }}
0 0
- 2016/12/8 1003. 简单哈希
- 简单哈希实现
- sicily 简单哈希
- 一致性哈希简单介绍
- Sicily 4699. 简单哈希
- HDU1880 简单字符串哈希
- (简单哈希)POJ1200
- POJ 3349 简单哈希
- poj 1840 简单哈希
- poj 2503 简单哈希
- Sicily 4699. 简单哈希
- 哈希加密的简单类
- 哈希算法简单实现和测试
- 哈希思想最简单应用---hdoj1425
- 简单哈希的C实现
- 简单哈希-hdoj-1425-sort
- 简单的一个哈希查找函数
- 哈希算法的又一简单应用
- mybatis多表关联查询
- Android 6.0下出错: UnsatisfiedLinkError: dlopen failed . text relocations
- hdu 5988 费用流
- 我在路上---贪懒
- CVPR 2016-12-01
- 2016/12/8 1003. 简单哈希
- 利用ajaxSubmit提交的时候,解决多个input name相同的问题
- javascript学习(四)表达式与运算符
- 序列、索引
- 【nova】nova resize,通过数据库修改flavor绕过迁移
- Kafka集群配置
- 【Spring】Spring高级话题-@Enable***注解的工作原理
- JavaSE学习(8) 排序
- laravel框架中使用QueryList插件采集数据