n数码问题, 全排列哈希
摘要:转载了一篇关于全排列的哈希函数,Poj1077就是应用了全排列的哈希;我们经常使用的数的进制为“常数进制”,即始终逢p进1。例如,p进制数K可表示为K = a0*p^0 + a1*p^1 + a2*p^2 + ... + an*p^n (其中0 pi,那么,如果在排列Q中qi之前的元素x与qi构成逆序对,即有x > qi,则在排列P中pi之前也有相同元素x > pi(因为x > qi且qi > pi),即在排列P中pi之前的元素x也与pi构成逆序对,所以pi的逆序数大于等于qi的逆序数。又qi与pi在排列P中构成pi的逆序对,所以pi的逆序数大于qi的逆序数。(2)同理
阅读全文
posted @
2013-10-22 20:38
straw_berry
阅读(707)
推荐(0)
Eight(bfs+全排列的哈希函数)
摘要:Time Limit:1000MSMemory Limit:65536KTotal Submissions:22207Accepted:9846Special JudgeDescriptionThe 15-puzzle has been around for over 100 years; even if you don't know it by that name, you've seen it. It is constructed with 15 sliding tiles, each with a number from 1 to 15 on it, and all pa
阅读全文
posted @
2013-10-22 20:36
straw_berry
阅读(517)
推荐(0)
Squares(哈希)
摘要:Time Limit:3500MSMemory Limit:65536KTotal Submissions:14328Accepted:5393DescriptionA square is a 4-sided polygon whose sides have equal length and adjacent sides form 90-degree angles. It is also a polygon such that rotating about its centre by 90 degrees gives the same polygon. It is not the only p
阅读全文
posted @
2013-08-16 10:40
straw_berry
阅读(318)
推荐(0)
Gold Balanced Lineup(哈希表)
摘要:Time Limit:2000MSMemory Limit:65536KTotal Submissions:10711Accepted:3182DescriptionFarmer John'sNcows (1 ≤N≤ 100,000) share many similarities. In fact, FJ has been able to narrow down the list of features shared by his cows to a list of onlyKdifferent features (1 ≤K≤ 30). For example, cows exhib
阅读全文
posted @
2013-08-15 20:20
straw_berry
阅读(285)
推荐(0)
Snowflake Snow Snowflakes(哈希,大素数取模)
摘要:Time Limit:4000MSMemory Limit:65536KTotal Submissions:27277Accepted:7197DescriptionYou may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true. Your program will read information about a collection of snowflakes, and search for a pair
阅读全文
posted @
2013-08-15 09:43
straw_berry
阅读(408)
推荐(0)
Eqs (哈希)
摘要:Time Limit:5000MSMemory Limit:65536KTotal Submissions:10695Accepted:5185DescriptionConsider equations having the following form:a1x13+ a2x23+ a3x33+ a4x43+ a5x53=0The coefficients are given integers from the interval [-50,50].It is consider a solution a system (x1, x2, x3, x4, x5) that verifies the
阅读全文
posted @
2013-08-14 16:01
straw_berry
阅读(242)
推荐(0)