题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4986题目意思:有 n 个box(从左到右编号依次为1~n),每个box里面有一个随机的钥匙,有可能这条钥匙恰好可以开到这个box,但大多数情况下是不能够的。问期望值是多少。(例如对于两个box,有可能装...
分类:
其他好文 时间:
2014-09-04 20:53:00
阅读次数:
248
A:Little Pony and Permutation
直接暴力搜索,复杂度O(n)
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#pragma comment(linker, "/STACK:1024000000,1024000000")
using n...
分类:
其他好文 时间:
2014-09-03 16:51:56
阅读次数:
211
Little Tim is now a graduate,and is thinking about higher studies. However, he first needs to appear in anexam whose preparation alone includes memorizing the meanings of over 3500words!
After going ...
分类:
其他好文 时间:
2014-09-03 13:10:06
阅读次数:
241
转自:http://blog.csdn.net/aklixiaoyao/article/details/7548860在各种计算机体系结构中,对于字节、字等的存储机制有所不同,因而引发了计算机通信领域中一个很重要的问题,即通信双方交流的信息单元(比特、字节、字、双字等等)应该以什么样的顺序进行传送。...
分类:
系统相关 时间:
2014-09-03 08:22:26
阅读次数:
324
题目链接
题意:有n盏灯,编号从1到n。他们绕成一圈,也就是说,1号灯的左边是n号灯。如果在第t秒的时候,某盏灯左边的灯是亮着的,那么就在第t+1秒的时候改变这盏灯的状态。输入m和初始灯的状态。输出m秒后,所有灯的状态。
思路:其实每盏灯的状态之和前一盏和自己有关,所以可以得到一个关系矩阵。假设有6盏灯,因此可以得到关系矩阵如下:
(1, 0, 0, 0, 0, 1)...
分类:
其他好文 时间:
2014-09-03 00:19:25
阅读次数:
324
字节序的问题涉及硬件架构,目前主要是Motorola的PowerPC系列CPU和Intel的x86系列CPU。PowerPC系列采用big endian方式存储数据,而x86系列则采用little endian方式存储数据。那么究竟什么是big endian,什么又是l...
分类:
其他好文 时间:
2014-09-02 12:44:05
阅读次数:
211
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4985题目意思:有 n 个数,对于第 i 个数给出 σ(i)的值。求出互不相交的循环的个数,并输出每个循环包含的数字。 还是不太懂吧?反正比赛的时候我也没看懂 >__ 3 —> 6 —> 1 (循环了)....
分类:
其他好文 时间:
2014-09-02 12:14:34
阅读次数:
411
DescriptionJessica's a very lovely girl wooed by lots of boys. Recently she has a problem. The final exam is coming, yet she has spent little time on ...
分类:
其他好文 时间:
2014-09-01 22:34:03
阅读次数:
294
puts "Mary had a little lamb. "puts "It's fleese was white as #{'snow'}."puts "And everywhere that Mary went."puts "." * 10 # what'd that do?end1 = "C...
分类:
其他好文 时间:
2014-09-01 22:22:03
阅读次数:
146
HDU 4985 Little Pony and Permutation
题目链接
题意:给定一个置换,输出分解成的循环
水题,直接模拟即可
代码:
#include
#include
#include
#include
using namespace std;
const int N = 100005;
int n, a[N], vis[N];
int...
分类:
其他好文 时间:
2014-09-01 15:39:03
阅读次数:
170