.
OutputIf you cannot finish this job, output "-1" or you shocould output the minimum number switches that you shoshould buy to turn on all the lanterns.
Sample Input4 200004 210014 201104 201110 0
Sample Output213-1Question:
Input n kAnd n 0 or 1If you convert all strings to 1, each step will change all k strings starting from pos to the opposite state. At least how many steps are required. If you cannot change all strings to 1, enter-1.
Idea: write several groups of data and you will find that
. This is a fast string. Besides the path string, it also contains the length of the string and a hash value.
@ Depth current path depth.
@ Saved_names: because the name of the Nd has been changing during symbolic link processing, it is used to save the path name in symbolic link processing.
There are many functions to search for the kernel path. Here we use path_lookup as the column, kernel version 2.6.24Path_lookup
int fastcall path_lookup(const
:210141
Source2012 Multi-University Training Contest 4
RecommendZhoujiaqi2010
Question:
Question: There are two strings and Q queries. Each query has two formats:
1 p I c: Replace the I character of the p string with the c character,
2i starts from the second I, and the maximum length of the two substrings that are consecutively the same.
IdeasIf the position I is the same, it is 0. If the position I is different, it is 1. In this way, it can be converted to the position where I is followed by t
number has been obtained, Filp_open to obtain a document structure, first listing the file structure as follows:struct file {struct list_headf_list;struct dentry*f_dentry;//pointer to the DENTRY structure of the file f_dentrystruct vfsmount *f_vfsmnt ;//Pointer to the VFSMNT structure that installs the file's device in the file system struct file_operations*f_op;atomic_tf_count;unsigned int f_flags;mode_tf_mode; loff_tf_pos;//current Read and write location unsigned long f_reada, F_rama
In the previous blog, we explained in detail the data structure related to file system installation. Now let's talk about how to install a specific file system.
1. Install a Common File System
Install the file system by calling the do_mount () function in sys_mount:Retval = do_mount (char *) dev_page, dir_page, (char *) type_page,Flags, (void *) data_page );
The do_mount () function performs the following operations to handle real installation operations:
Long do_mount (char * dev_name, char *
In the Linux kernel source scenario analysis-File system installation, in the article, sudo mount-t ext2/dev/sdb1/mnt/sdb has been called, and the file system is mounted on the/MNT/SDB node, then we then visit/mnt/sdb/ The HELLO.C node. Let's see what's the difference between Path_walk's execution? int Path_walk (const char * name, struct nameidata *nd) {struct dentry *dentry;struct inode *inode;int err;unsigned int look Up_flags =
dentry in the first two items records the information of the parent directory of the directory to be created. The mnt member will explain it later. The last three records are the information of the last node (that is, the directory or file to be created) of the path to be searched. Currently, sys_mkdir ("/dev", 0700) is called to create the directory "/dev". The parameter 0700 is ignored. It only limits the mode of the directory to be created. The sys_mkdir function first calls path_lookup ("/d
information of the parent directory of the directory to be created. The mnt member will explain it later. The last three records are the information of the last node (that is, the directory or file to be created) of the path to be searched. Currently, sys_mkdir ("/dev", 0700) is called to create the directory "/dev". The parameter 0700 is ignored. It only limits the mode of the directory to be created. The sys_mkdir function first calls path_lookup ("/dev", LOOKUP_PARENT,
simplifies the problem, and the data range is about n Puzzle: The node of the segment tree is defined as follows:struct node{ int cnt, h; h = "Interval" Height bool LF, RF; mark the leftand right endpoint is equal to 0}nd[n2];Nodes should have a left and right end point, in order to save memory is not written, write the function when the endpoint as a parameter passed on it (see Code).CNT represents the number of consecutive segments with a
MNT members will explain next. The last three entries record information for the final node of the found path (that is, the directory or file to be built). Now call Sys_mkdir ("/dev", 0700) to establish the directory "/dev", where parameter 0700 we do not control it, it is just a certain pattern of the directory that will be established. The Sys_mkdir function first calls path_lookup ("/dev", lookup_parent, nd) to find the path, where
A radical operation can take up to 5 times to turn any number that appears into 1.So use the line tree to modify the violence, in the future, only need to see if the current interval is 0 or 1, if so the direct return.1 /**************************************************************2 problem:32113 user:idy0024 language:c++5 result:accepted6 time:1976 Ms7 memory:7068 KB8 ****************************************************************/9 Ten#include One#include A #defineN 100010 - -typedefLon
Objective
When working on a file in Linux, it's important to parse the file name, find the Inode object for the file, and then create a file object that represents the files. Here, the file name parsing process, and how to find the corresponding inode process for source code analysis. The parsing code is based on the Linux-3.2 version.
Critical function Analysis
Whether it is through the application Layer API functions or open a file in the kernel, the final call to the Filp_open function, th
. The tool also provides a set of default ports for profiles that can be modified if necessary, and the default ports cannot be assigned to profiles that are already in use by WebSphere application Server on the same server to avoid conflicts with any other ports. The tool also does not provide the ports used by services other than WebSphere application Server. Figure 1. Profile Creation Tool
By default, the profile created is located under the
If you are using WebSphere application Server Netw
information of the last node (that is, the directory or file to be created) of the path to be searched. Currently, sys_mkdir ("/dev", 0700) is called to create the directory "/dev". The parameter 0700 is ignored. It only limits the mode of the directory to be created. The sys_mkdir function first calls path_lookup ("/dev", LOOKUP_PARENT, nd); to find the path, where nd is the variable declared by struct n
implementation of the thinking:Minlen (i) =min{minlen (i), Minlen (j) +a[j][i]}Wherein, I is the target point, J is a point before I, traverse all other points for J, if not adjacent, then A[j][i]=max.This implements the following code.2. The initial realization of C language#include #include #define N 7#define MAX 0X0FFFFFFFtypedef struct _NODE{int way[n-1];int Len;}node;void Addway (node *nd,int n,int type)//type=1 means finding a new minimum path,
Summary of common PHP string functions I. judgment functions
Is_bool () // determine whether it is a Boolean is_float () // determine whether it is a floating-point is_real () // same as is_int () // determine whether it is an integer is_integer () // same as is_string () // determine whether it is a string is_object () // determine whether it is an object is_array () // determine whether it is an array is_null () // determine whether it is nullis_file () // determine whether it is a file is_d
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.