回答 2 已采纳 Find out whether a given text file contains a given word W.
If the word W exists in the file, place in the output file the line number and the position in the line number of the last entry of the word. Otherwise place two numbers: 0 0. During text analysis do not take into consideration word carry-over, that is, the sought for word may begin on one line and end on another. The text may as well contain empty lines, which are also numbered, but must not be taken into account in searching for the word W.
Length (L) of the word W complies with the condition: 0 < L <= 255.
Length (S) of the lines of the input file complies with the condition: 0 <= S <= 255.
The number of lines in the input file does not exceed 100000.
The input text may contain any symbols in the range of 32..255. The input text does NOT contain any other symbols.
The first line of the input file contains the word W. A word here is understood as a non-empty sequence of symbols. The second line contains the number of lines to follow. Beginning with the third(!) line the text, consisting of one or more lines (maybe empty), goes.
Process to the end of file.
The output numbers must be separated by one space.
回答 1 已采纳 Problem Description
Cell 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.
Identifying motifs and corresponding instances are very important, so biologists can investigate the interactions between DNA and proteins, gene regulation, cell development and cell reaction.
Given 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.
Your 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.
For example, n=7, m =7, l=40, w =8, d =2. The sequences are as follows (they are all key sequences):
The motif P is ATGCAACT.
The 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.
Then followed by n lines, in which each line contains one sequence. The input is terminated by three zeros.
For 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”.
3 2 4
3 2 4
0 0 0
回答 1 已采纳 Problem Description
A 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.
The 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.
The 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.
They’ve taken out a laptop and pointed at you to help them find those desired seats.
Each 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.
Input is terminated with R = C = K = 0.
For each test case, output a single line containing the minimum extension the group can have.
3 5 5
5 6 6
0 0 0
回答 1 已采纳 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.
After 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.
All 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.
Figure-1 shows an example of the labyrinth and the path Marlin went through to find Nemo.
We 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.
The 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:
x y d t
(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].
Then there are N lines that give the description of the doors:
x y d
x, y, d have the same meaning as the walls. As the doors have fixed length of 1, t is omitted.
The last line of each case contains two positive float numbers:
(f1, f2) gives the position of Nemo. And it will not lie within any wall or door.
A test case of M = -1 and N = -1 indicates the end of input, and should not be processed.
For 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.
1 1 1 3
2 1 1 3
3 1 1 3
4 1 1 3
1 1 0 3
1 2 0 3
1 3 0 3
1 4 0 3
2 1 1
2 2 1
2 3 1
3 1 1
3 2 1
3 3 1
1 2 0
3 3 0
4 3 1
1 1 0 1
1 1 1 1
2 1 1 1
1 2 0 1
回答 2 已采纳 Consider 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.
Your 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.
The 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.
Note 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.
The 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.
A 1 1
B 2 1
C 3 1
D 2 3
E 3 3
F 1 4
G 3 4
B 1 1
D 2 1
F 4 1
J 4 4
L 2 4
M 2 3
N 4 3
P 1 2
A 1 5
B 2 5
C 1 4
D 2 4
E 1 3
F 2 3
G 1 2
H 2 2
I 1 1
J 2 1
K 1 0
L 2 0
B 1 1
D 2 1
L 2 4
N 2 3
P 1 2
Point set 1:
Point set 2:
LJFD LJNM MNFD
Point set 3:
ABDC ABFE ABHG ABJI ABLK CDFE CDHG CDJI CDLK EFHG
EFJI EFLK GHJI GHLK IJLK
Point set 4: No rectangles
回答 1 已采纳 Problem Description
We'll consider an interesting geometric problem here. Given a number of circles with varying radius on the plane, and define the P-value of a point (x, y) on the plane as the number of circles covering this point. Here, by "covering", we mean that the point is either strictly within the circle, or on the boundary of the circle.
Given the starting position (Sx, Sy), and the destination position (Tx, Ty), please find a path between the two points, such that every point of the path is on the boundary of one or more circles, and the absolute difference between the maximum P-value and the minimum P-value among all points on the path is minimized.
Can you find the minimum absolute value with the help of your computer?
There are multiple test cases in the input file. Each test case starts with one integer N (1 = 1), indicating that there is a circle at position (X, Y) with radius R.
There is a blank line after each test case. Input ends with End-of-File.
Note: It is guaranteed that the input data is always legal, i.e. both the starting position and the destination are on the boundary of one or more circles, no two circles will be at the same position, every real number in the input file has at most three digits after the decimal point, and the absolute value of any real number does not exceed 10000.
For each test case, output one integer on one separate line as requested. If there is no way to reach the destination, output -1 instead.
-1.000 0.000 1.000 0.000
0.000 0.000 1.000
1.000 0.000 1.000
-1.000 0.000 5.000 0.000
-1.000 -1.000 1.000
4.000 0.000 1.000
Case 1: 1
Case 2: -1
回答 1 已采纳
I have been looking through the YouTube API for awhile now, but am not finding a simple way to auto-fetch all videos from a certain account and then display them on the screen. I am planning on using PHP in order to accomplish this, but otherwise I am open to suggestions of how to accomplish this.
Thanks for any help.
回答 2 已采纳 Pete is playing a game. He types on a calculator a natural number K and then presses the '+' key. The display still shows K. Pete wants to have on the display a number that is formed using only one figure. In order to get that he presses, if it is necessary, the '=' key several times (maybe 0). The result after the first pressing is K+K. After each pressing the number K is added to the sum. Find out whether Pete will achieve his goal or not, and what number, consisting all of identical figures, he will get first. Consider the capacity of the calculator to be unlimited.
K < 1000
The input file contains the number K.
Process to the end of file.
The output file must contain two numbers: first the figure that forms the result and then the number of digits of the result. If multiple solution exists, first minimize the figure then minimize the number of digits. If finding the desired result is impossible, the output file must contain only one number -1 (minus 1). The numbers in the output file must be separated by one space.
cum88284的博客 During a presentation, a mix of media always performs best. Using images, graphs, charts, and videos not only makes your presentation more informative but also more engaging for the audience. If you h...
weixin_26711425的博客 When I started my programming apprenticeship in 2012, we weren’t allowed to use YouTube tutorials, so oftentimes I would spend the day struggling and then watch the videos on my own time and feel bad...
weixin_30569001的博客 https://www.quora.com/What-is-the-best-way-to-download-YouTube-videos-for-free There are various methods to download YouTube video for free. How To Download Youtube Videos ...
yfk的博客 I've gathered together in one place a few lessons in scalability from seven of the most highly trafficked websites around. I've grabbed this primarily from various articles on the excellentHigh Scalab
行走江湖要用艺名的博客 [论文阅读 2020 CVPR]Kernelized Memory Network for Video Object SegmentationSemi-Supervised. KMNSTM在VOS任务中的问题KMN ContributionHide-and-SeekMemory ReadSTM Memory ReadKernelized Memory ...
culi4814的博客 There is definitely something suspect about any parenting style that involves plopping your kids in front of a video for extended periods of time. At the same time, however, teaching your kids how to....
cumi7754的博客 Managing a YouTube channel is a lot of work. It includes content experimentation which can make or break your SEO effectiveness for your channel. How can we track our channel’s performance to see ...
GavinZhou_xd的博客 转载自: http://hyperparameter.space/blog/when-not-to-use-deep-learning/I know it’s a weird way to start a blog with a negative, but there was a wave of discussion in the last few days that I think ...
rokia_xmu的博客 Youtube.com is the second most accessed website in the world (surpassed only by its parent, google.com). It has a whopping 1 billion unique views a month. [1, 2] It is a force to be reckoned with. ...
菜菜菜菜菜菜菜的博客 Highlight Detection with Pairwise Deep Ranking for First-Person Video Summarization Abstract 诸如便携式相机和智能眼镜之类的可穿戴设备的出现使录制生活记录的第一人称视频成为可能。浏览这么长的非结构化...
六半的博客 1) Face DataSet: 1.CASIA-3DFaceV1 链接：https://pan.baidu.com/s/1l__ea4BWjrL9C6Ahl8LqOQ&nbsp;密码：kyho http://www.cbsr.ia.ac.cn/english/3dface%20databases.asp ...collected a 3D face datab...
ujn20161222的博客 So long, and thanks for the Ph.D...A computer science graduate school survival guide, intended for prospective or novice graduate students. This guide describes what I wish I had known at the start of gr