Linux命令-finding files

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

finding files by name


finding by file size


$ find /usr/share/ -size +10M
$ find /mostlybig -size -1M

# searching for files that are between 500MB and 5GB.
$ find /bigdata -size +500M -size -5G -exec du -sh {} \;



Finding Rectangles


nConsider the point sets in figures 1a, 2a, and 3a. Using only those points as vertices, figures 1b, 2b, and 3b show all the rectangles that can be formed with horizontal and vertical sides. No rectangles can be formed from the points in figure 4.nnnnYour task is to write a program that can find all rectangles that can be formed from a given set of points. The example input and output given below correspond to the figures above.nnnInputnnThe input contains one or more point sets, followed by a line containing the number 0 that signals the end of the file. Each point set begins with a line containing n, the number of points, and is followed by n lines that describe the points. Each point description contains a capital letter that is the label of the point, then a space, the horizontal coordinate, a space, and the vertical coordinate. Within each set, points labels occur in alphabetical order.nnNote that since each point is labelled with a capital letter there can be at most 26 points. All coordinates are nonnegative integers less than 50. Points within a set are unique.nnnOutputnnThe output for each point set starts with ``Point set ", followed by the number of the point set and a colon. If there are no rectangles, `` No rectangles" appears after the colon. If there are rectangles, they are listed starting on the next line. A blank precedes each rectangle. Each rectangle is given by its vertex labels, in clockwise order from the upper left, so the order is upper left, upper right, lower right, lower left. The rectangles are listed ten per line, except for the last line, where there may be as few as one. The rectangles are listed in alphabetical order.nnSample Inputnn7nA 1 1 nB 2 1 nC 3 1 nD 2 3 nE 3 3 nF 1 4 nG 3 4 n8 nB 1 1 nD 2 1 nF 4 1 nJ 4 4 nL 2 4nM 2 3nN 4 3 nP 1 2 n12nA 1 5nB 2 5nC 1 4nD 2 4nE 1 3nF 2 3nG 1 2nH 2 2nI 1 1nJ 2 1nK 1 0nL 2 0n5nB 1 1nD 2 1nL 2 4nN 2 3nP 1 2n0nnnSample OutputnnPoint set 1:n DECB FGCAnPoint set 2:n LJFD LJNM MNFDnPoint set 3:n ABDC ABFE ABHG ABJI ABLK CDFE CDHG CDJI CDLK EFHGn EFJI EFLK GHJI GHLK IJLKnPoint set 4: No rectanglesn 问答

Finding Seats


Problem DescriptionnA group of K friends is going to see a movie. However, they are too late to get good tickets, so they are looking for a good way to sit all nearby. Since they are all science students, they decided to come up with an optimization problem instead of going on with informal arguments to decide which tickets to buy.nnThe movie theater has R rows of C seats each, and they can see a map with the currently available seats marked. They decided that seating close to each other is all that matters, even if that means seating in the front row where the screen is so big it’s impossible to see it all at once. In order to have a formal criteria, they thought they would buy seats in order to minimize the extension of their group.nnThe extension is defined as the area of the smallest rectangle with sides parallel to the seats that contains all bought seats. The area of a rectangle is the number of seats contained in it.nnThey’ve taken out a laptop and pointed at you to help them find those desired seats.n nnInputnEach test case will consist on several lines. The first line will contain three positive integers R, C and K as explained above (1 <= R,C <= 300, 1 <= K <= R × C). The next R lines will contain exactly C characters each. The j-th character of the i-th line will be ‘X’ if the j-th seat on the i-th row is taken or ‘.’ if it is available. There will always be at least K available seats in total.nInput is terminated with R = C = K = 0.n nnOutputnFor each test case, output a single line containing the minimum extension the group can have.n nnSample Inputn3 5 5n...XXn.X.XXnXX...n5 6 6n..X.X.n.XXX..n.XX.X.n.XXX.Xn.XX.XXn0 0 0n nnSample Outputn6n9 问答

Finding Nemo


Nemo is a naughty boy. One day he went into the deep sea all by himself. Unfortunately, he became lost and couldn't find his way home. Therefore, he sent a signal to his father, Marlin, to ask for help.nnAfter checking the map, Marlin found that the sea is like a labyrinth with walls and doors. All the walls are parallel to the X-axis or to the Y-axis. The thickness of the walls are assumed to be zero.nnAll the doors are opened on the walls and have a length of 1. Marlin cannot go through a wall unless there is a door on the wall. Because going through a door is dangerous (there may be some virulent medusas near the doors), Marlin wants to go through as few doors as he could to find Nemo.nnFigure-1 shows an example of the labyrinth and the path Marlin went through to find Nemo.nnnnWe assume Marlin's initial position is at (0, 0). Given the position of Nemo and the configuration of walls and doors, please write a program to calculate the minimum number of doors Marlin has to go through in order to reach Nemo.nnInputnnThe input consists of several test cases. Each test case is started by two non-negative integers M and N. M represents the number of walls in the labyrinth and N represents the number of doors. Then follow M lines, each containing four integers that describe a wall in the following format:nx y d tnn(x, y) indicates the lower-left point of the wall, d is the direction of the wall - 0 means it's parallel to the X-axis and 1 means that it's parallel to the Y-axis, and t gives the length of the wall. The coordinates of two ends of any wall will be in the range of [1,199].nnThen there are N lines that give the description of the doors:nnx y dnnx, y, d have the same meaning as the walls. As the doors have fixed length of 1, t is omitted.nnThe last line of each case contains two positive float numbers:nnf1 f2nn(f1, f2) gives the position of Nemo. And it will not lie within any wall or door.nnA test case of M = -1 and N = -1 indicates the end of input, and should not be processed.nnOutputnnFor each test case, in a separate line, please output the minimum number of doors Marlin has to go through in order to rescue his son. If he can't reach Nemo, output -1.nnSample Inputnn8 9n1 1 1 3n2 1 1 3n3 1 1 3n4 1 1 3n1 1 0 3n1 2 0 3n1 3 0 3n1 4 0 3n2 1 1n2 2 1n2 3 1n3 1 1n3 2 1n3 3 1n1 2 0n3 3 0n4 3 1n1.5 1.5n4 0n1 1 0 1n1 1 1 1n2 1 1 1n1 2 0 1n1.5 1.7n-1 -1nSample Outputnn5n-1 问答

Motif Finding


Problem DescriptionnCell differentiation and development are fundamentally controlled by gene regulation. Only a subset of genes in the genome is expressed in a cell at a given time under given conditions. Regulatory sites on DNA sequence normally correspond to shared conservative sequence patterns among the regulatory regions of correlated genes. We call these conserved sequence motifs. The actual regulatory DNA sites corresponding to a motif are called the instances of that motif. nIdentifying motifs and corresponding instances are very important, so biologists can investigate the interactions between DNA and proteins, gene regulation, cell development and cell reaction.nnnGiven two equal-length strings, the Hamming Distance is the number of positions in which the corresponding characters are different. For example, the Hamming Distance between “ACTG” and “ATCG” is 2 because they differ at the 2nd and 3rd positions.nnYour task is to find a motif for a few DNA sequences. Every DNA sequence consists of only A, C, G, T. If a substring of DNA sequence S has the same length with motif P and their Hamming Distance is not more than d, we say that S includes an instance of P. Given n DNA sequences with length of l. Among them, m sequences are “key sequences”. You need to find out the motif P whose length is w, so that every key sequence includes an instance of motif P. What’s more, the number of DNA sequences which include an instance of P should be as large as possible.nnFor example, n=7, m =7, l=40, w =8, d =2. The sequences are as follows (they are all key sequences):nn![]( motif P is ATGCAACT.nn nnInputnThe input contains several cases. The first line of each case contains three integers n (1 ≤ n ≤ 15), m (0 ≤ m ≤ n) and l (1 ≤ l ≤ 10,000). The second line contains two integers w (1 ≤ w ≤ 8) and d (0 ≤ d ≤ w). The third line contains m unique integers ranging from 0 to n-1, indicating the key sequences. nnThen followed by n lines, in which each line contains one sequence. The input is terminated by three zeros.n nnOutputnFor each case, output the motif P in one line. If the solution is not unique, then output the lexicographically smallest one. If there is no answer, you should output “No solution”.n nnSample Inputn3 2 4n3 1n0 2nACTTnCGTGnCCCCn3 2 4n3 0n0 2nACTTnCGTGnCCCCn0 0 0n nnSample OutputnCCTnNo solutionn n 问答