题意是说有N个字母组成的密码锁, 如[wersdfj], 每一位上的字母可以转动, w可转动变成x, z变成a.但是题目规定, 只能同时转动某个区间上的所有字母, 如[1,3], 那么第1到第3个的所有字母要同时转动,那么[ wersdfj ]经过一次操作就变成 [ xfssdfj ]. 一共有M 个区间是可以操作的. 题目还规定:If a lock can change to another after a sequence of operations, we regard them…
Code LockTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 2006 Accepted Submission(s): 766 Problem DescriptionA lock you use has a code system to be opened instead of a key. The lock contains a seq…
Code Lock Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 255 Accepted Submission(s): 114 Problem Description A lock you use has a code system to be opened instead of a key. The lock contains a…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3461 A lock you use has a code system to be opened instead of a key. The lock contains a sequence of wheels. Each wheel has the 26 letters of the English alphabet 'a' through 'z', in order. If you move a…
#include<stdio.h> #include<math.h> ]; int count; #define mod 1000000007 int find(int x) { int r=x; while(r!=set[r]) r=set[r]; int i=x; while(i!=r) { int j=set[i]; set[i]=r; i=j; } return r; } void merge(int x,int y) { int fx=find(x); int fy=fi…