摘要:
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2232 直接进入正题,这题要求解的是一个条件极其宽松下的组合题,似乎在看见这题的时候,我们就能遇见这道题的答案会是多么的庞大,所以题中也才会有 % 9937 这样的提示。对于如此大的一个运算,只走一步的话还好办,有9种情况,(顺时针和逆时针旋转2次加上相邻两个交换位置(交换一对的4次,交换两对的2次)最后加上原地不动的1次),就1次就够麻烦的,计算结果表明,两步共有633种可能, 足以见得后面的情况是多么的复杂。 各种百度后,我接受了接下来说明的好的方法。保留一定量的信息,通过递推求得,再在这些.. 阅读全文
摘要:
这题在计算时就把没一点到第一个点的距离计算出来,再相减就出来了。每条线段都存储起来。 http://acm.hdu.edu.cn/showproblem.php?pid=2073 代码如下:#include <cstdio>#include <cstdlib>#include <cmath>#include <cstring>#include <iostream>using namespace std;double d[10005], D[10005];double sqrt_2 = sqrt( 2.0 );double dis( i 阅读全文
摘要:
Tempter of the Bone IITime Limit: 10000/5000 MS (Java/Others)Memory Limit: 98304/32768 K (Java/Others)Total Submission(s): 704Accepted Submission(s): 160Problem DescriptionThe doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze was changed and 阅读全文
摘要:
水题,首先把两个数组的的长度设为一样的,即空位补零,数字在数组中以右对齐方式存储。 代码如下: 1 #include <cstdlib> 2 #include <cstring> 3 #include <cstdio> 4 using namespace std; 5 6 int main() 7 { 8 char a[10], b[10], aa[10], bb[10]; 9 int bit, num1, num2;10 while( 1 )11 {12 memset( a, '0', sizeof( a ) );13 ... 阅读全文
摘要:
前面用二维线段树写了个,代码长不说,而且效率还慢的要死!!!!! Orz...... 这题如果用树状数组来解的话,代码量很小而且速度很快。二维树状数组就在循环上面再加一层循环。 代码如下:#include <cstdlib>#include <cstdio>#include <cstring>#define LOWBIT( x ) (x) & -(x)using namespace std;int rec[1040][1040], N;inline void CinInt( int &t ){ char f = 1, c; while( c 阅读全文
摘要:
Luck and LoveTime Limit: 10000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2438Accepted Submission(s): 627Problem Description世界上上最远的距离不是相隔天涯海角而是我在你面前可你却不知道我爱你―― 张小娴前段日子,枫冰叶子给Wiskey做了个征婚启事,聘礼达到500万哦,天哪,可是天文数字了啊,不知多少MM蜂拥而至,顿时万人空巷,连扫地的大妈都来凑热闹来了。―_―|||由于人数太多,Wiskey 阅读全文
摘要:
Mobile phonesTime Limit:5000MSMemory Limit:65536KTotal Submissions:9263Accepted:4154DescriptionSuppose that the fourth generation mobile phone base stations in the Tampere area operate as follows. The area is divided into squares. The squares form an S * S matrix with the rows and columns numbered f 阅读全文
摘要:
MatrixTime Limit:3000MSMemory Limit:65536KTotal Submissions:10544Accepted:3945DescriptionGiven an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] = 0 (1 <= i, j <= N).We can change the matrix in the following w 阅读全文
摘要:
Rare OrderTime Limit:3000MSMemory Limit:Unknown64bit IO Format:%lld & %llu[Submit] [Go Back] [Status]DescriptionRare OrderA rare book collector recently discovered a book written in an unfamiliar language that used the same characters as the English language. The book contained a short index, bu 阅读全文
摘要:
The Broken PedometerThe ProblemA marathon runner uses a pedometer with which he is having problems. In the pedometer the symbols are represented by seven segments (or LEDs):But the pedometer does not work properly (possibly the sweat affected the batteries) and only some of the LEDs are active. The 阅读全文