
回答 1 已采纳 n the year 29XX, the government of a small country somewhere on the earth introduced a law restricting first names of the people only to traditional names in their culture, in order to preserve their cultural uniqueness. The linguists of the country specifies a set of rules once every year, and only names conforming to the rules are allowed in that year. In addition, the law also requires each person to use a name of a specific length calculated from one��s birth date because otherwise too many people would use the same very popular names. Since the legislation of that law, the common task of the parents of new babies is to find the name that comes first in the alphabetical order among the legitimate names of the given length because names earlier in the alphabetical order have various benefits in their culture.
Legitimate names are the strings consisting of only lowercase letters that can be obtained by repeatedly applying the rule set to the initial string ��S��, a string consisting only of a single uppercase S.
Applying the rule set to a string is to choose one of the rules and apply it to the string. Each of the rules has the form A �� ��, where A is an uppercase letter and �� is a string of lowercase and/or uppercase letters. Applying such a rule to a string is to replace an occurrence of the letter A in the string to the string ��. That is, when the string has the form ����A����, where �� and �� are arbitrary (possibly empty) strings of letters, applying the rule rewrites it into the string ���¦�����. If there are two or more occurrences of A in the original string, an arbitrary one of them can be chosen for the replacement.
Below is an example set of rules.
S �� aAB (1)
A �� (2)
A �� Aa (3)
B �� AbbA (4)
Applying the rule (1) to ��S��, ��aAB�� is obtained. Applying (2) to it results in ��aB��, as A is replaced by an empty string. Then, the rule (4) can be used to make it ��aAbbA��. Applying (3) to the first occurrence of A makes it ��aAabbA��. Applying the rule (2) to the A at the end results in ��aAabb��. Finally, applying the rule (2) again to the remaining A results in ��aabb��. As no uppercase letter remains in this string, ��aabb�� is a legitimate name.
We denote such a rewriting process as follows.
S��(1)aAB��(2)aB��(4)aAbbA��(3)aAabbA��(2)aAabb��(2)aabb
Linguists of the country may sometimes define a ridiculous rule set such as follows.
S �� sA (1)
A �� aS (2)
B �� b (3)
The only possible rewriting sequence with this rule set is:
S��(1)sA��(2)saS��(1)sasA��(2)��
which will never terminate. No legitimate names exist in this case. Also, the rule (3) can never be used, as its left hand side, B, does not appear anywhere else.
It may happen that no rules are supplied for some uppercase letters appearing in the rewriting steps. In its extreme case, even S might have no rules for it in the set, in which case there are no legitimate names, of course. Poor nameless babies, sigh!
Now your job is to write a program that finds the name earliest in the alphabetical order among the legitimate names of the given length conforming to the given set of rules.
Input
The input is a sequence of datasets, followed by a line containing two zeros separated by a space representing the end of the input. Each dataset starts with a line including two integers n and l separated by a space, where n (1 �� n �� 50) is the number of rules and l (0 �� l �� 20) is the required length of the name. After that line, n lines each representing a rule follow. Each of these lines starts with one of uppercase letters, A to Z, followed by the character ��=�� (instead of ����) and then followed by the right hand side of the rule which is a string of letters A to Z and a to z. The length of the string does not exceed 10 and may be zero. There appears no space in the lines representing the rules.
Output
The output consists of the lines showing the answer to each dataset in the same order as the input. Each line is a string of lowercase letters, a to z, which is the first legitimate name conforming to the rules and the length given in the corresponding input dataset. When the given set of rules has no conforming string of the given length, the corresponding line in the output should show a single hyphen, ����. No other characters should be included in the output.
Sample Input
4 3
A=a
A=
S=ASb
S=Ab
2 5
S=aSb
S=
1 5
S=S
1 0
S=S
1 0
A=
2 0
A=
S=AA
4 5
A=aB
A=b
B=SA
S=A
4 20
S=AAAAAAAAAA
A=aA
A=bA
A=
0 0
Sample Output
abb




aabbb
aaaaaaaaaaaaaaaaaaaa

回答 1 已采纳 Description
The main land of Japan called Honshu is an island surrounded by the sea. In such an island, it is natural to ask a question: “Where is the most distant point from the sea?” The answer to this question for Honshu was found in 1996. The most distant point is located in former Usuda Town, Nagano Prefecture, whose distance from the sea is 114.86 km.
In this problem, you are asked to write a program which, given a map of an island, finds the most distant point from the sea in the island, and reports its distance from the sea. In order to simplify the problem, we only consider maps representable by convex polygons.
Input
The input consists of multiple datasets. Each dataset represents a map of an island, which is a convex polygon. The format of a dataset is as follows.
n
x1 y1
⋮
xn yn
Every input item in a dataset is a nonnegative integer. Two input items in a line are separated by a space.
n in the first line is the number of vertices of the polygon, satisfying 3 ≤ n ≤ 100. Subsequent n lines are the x and ycoordinates of the n vertices. Line segments (xi, yi)–(xi+1, yi+1) (1 ≤ i ≤ n − 1) and the line segment (xn, yn)–(x1, y1) form the border of the polygon in counterclockwise order. That is, these line segments see the inside of the polygon in the left of their directions. All coordinate values are between 0 and 10000, inclusive.
You can assume that the polygon is simple, that is, its border never crosses or touches itself. As stated above, the given polygon is always a convex one.
The last dataset is followed by a line containing a single zero.
Output
For each dataset in the input, one line containing the distance of the most distant point from the sea should be output. An output line should not contain extra characters such as spaces. The answer should not have an error greater than 0.00001 (10−5). You may output any number of digits after the decimal point, provided that the above accuracy condition is satisfied.
Sample Input
4
0 0
10000 0
10000 10000
0 10000
3
0 0
10000 0
7000 1000
6
0 40
100 20
250 40
250 70
100 90
0 70
3
0 0
10000 10000
5000 5001
0
Sample Output
5000.000000
494.233641
34.542948
0.353553

回答 1 已采纳 Given a triangle ABC, the Extriangles of ABC are constructed as follows:
On each side of ABC, construct a square (ABDE, BCHJ and ACFG in the figure below).
Connect adjacent square corners to form the three Extriangles (AGD, BEJ and CFH in the figure).
The Exomedians of ABC are the medians of the Extriangles, which pass through vertices of the original triangle, extended into the original triangle (LAO, MBO and NCO in the figure. As the figure indicates, the three Exomedians intersect at a common point called the Exocenter (point O in the figure).
This problem is to write a program to compute the Exocenters of triangles.
![](http://acm.zju.edu.cn/onlinejudge/showImage.do?name=0000%2F1821%2F1821.gif)
Input
The first line of the input consists of a positive integer n, which is the number of datasets that follow. Each dataset consists of 3 lines; each line contains two floating point values which represent the (two dimensional) coordinate of one vertex of a triangle. So, there are total of (n*3) + 1 lines of input. Note: All input triangles wi ll be strongly nondegenerate in that no vertex will be within one unit of the line through the other two vertices.
Output
For each dataset you must print out the coordinates of the Exocenter of the input triangle correct to four decimal places.
Sample Input
2
0.0 0.0
9.0 12.0
14.0 0.0
3.0 4.0
13.0 19.0
2.0 10.0
Sample Output
9.0000 3.7500
48.0400 23.3600

回答 1 已采纳 Problem Description
Today is the birthday of Mr. Bon Vivant, who is known as one of the greatest p鈚issiers in the world. Those who are invited to his birthday party are gourmets from around the world. They are eager to see and eat his extremely creative cakes. Now a large boxshaped cake is being carried into the party. It is not beautifully decorated and looks rather simple, but it must be delicious beyond anyone's imagination. Let us cut it into pieces with a knife and serve them to the guests attending the party.
The cake looks rectangular, viewing from above (Figure C1). As exemplified in Figure C2, the cake will iteratively be cut into pieces, where on each cut exactly a single piece is cut into two smaller pieces. Each cut surface must be orthogonal to the bottom face and must be orthogonal or parallel to a side face. So, every piece shall be rectangular looking from above and every side face vertical.
Figure C1: The top view of the cake
Figure C2: Cutting the cake into pieces
Piece sizes in Figure C2 vary significantly and it may look unfair, but you don't have to worry. Those guests who would like to eat as many sorts of cakes as possible often prefer smaller pieces. Of course, some prefer larger ones.
Your mission of this problem is to write a computer program that simulates the cutting process of the cake and reports the size of each piece.
Input
The input is a sequence of datasets, each of which is of the following format.
n w d
p1 s1
...
pn sn
The first line starts with an integer n that is between 0 and 100 inclusive. It is the number of cuts to be performed. The following w and d in the same line are integers between 1 and 100 inclusive. They denote the width and depth of the cake, respectively. Assume in the sequel that the cake is placed so that w and d are the lengths in the eastwest and northsouth directions, respectively.
Each of the following n lines specifies a single cut, cutting one and only one piece into two. pi is an integer between 1 and i inclusive and is the identification number of the piece that is the target of the ith cut. Note that, just before the ith cut, there exist exactly i pieces. Each piece in this stage has a unique identification number that is one of 1, 2, ..., i and is defined as follows:
* The earlier a piece was born, the smaller its identification number is.
* Of the two pieces born at a time by the same cut, the piece with the smaller area (looking from above) has the smaller identification number. If their areas are the same, you may define as you like the order between them, since your choice in this case has no influence on the final answer.
Note that identification numbers are adjusted after each cut.
si is an integer between 1 and 1000 inclusive and specifies the starting point of the ith cut. From the northwest corner of the piece whose identification number is pi, you can reach the starting point by traveling si in the clockwise direction around the piece. You may assume that the starting point determined in this way cannot be any one of the four corners of the piece. The ith cut surface is orthogonal to the side face on which the starting point exists.
The end of the input is indicated by a line with three zeros.
Output
For each dataset, print in a line the areas looking from above of all the pieces that exist upon completion of the n cuts specified in the dataset. They should be in ascending order and separated by a space. When multiple pieces have the same area, print it as many times as the number of the pieces.
Sample Input
3 5 6
1 18
2 19
1 2
3 4 1
1 1
2 1
3 1
0 2 5
0 0 0
Sample Output
4 4 6 16
1 1 1 1
10

回答 1 已采纳 Description
Given a triangle ABC, the Extriangles of ABC are constructed as follows:
On each side of ABC, construct a square (ABDE, BCHJ and ACFG in the figure below).
Connect adjacent square corners to form the three Extriangles (AGD, BEJ and CFH in the figure).
The Exomedians of ABC are the medians of the Extriangles, which pass through vertices of the original triangle,extended into the original triangle (LAO, MBO and NCO in the figure. As the figure indicates, the three Exomedians intersect at a common point called the Exocenter (point O in the figure).
This problem is to write a program to compute the Exocenters of triangles.
![](http://poj.org/images/1673_1.jpg)
Input
The first line of the input consists of a positive integer n, which is the number of datasets that follow. Each dataset consists of 3 lines; each line contains two floating point values which represent the (two dimensional) coordinate of one vertex of a triangle. So, there are total of (n*3) + 1 lines of input. Note: All input triangles wi ll be strongly nondegenerate in that no vertex will be within one unit of the line through the other two vertices.
Output
For each dataset you must print out the coordinates of the Exocenter of the input triangle correct to four decimal places.
Sample Input
2
0.0 0.0
9.0 12.0
14.0 0.0
3.0 4.0
13.0 19.0
2.0 10.0
Sample Output
9.0000 3.7500
48.0400 23.3600

回答 1 已采纳 Problem Description
We wish to tile a grid 4 units high and N units long with rectangles (dominoes) 2 units by one unit (in either orientation). For example, the figure shows the five different ways that a grid 4 units high and 2 units wide may be tiled.
Write a program that takes as input the width, W, of the grid and outputs the number of different ways to tile a 4byW grid.
Input
The first line of input contains a single integer N, (1 ≤ N ≤ 1000) which is the number of datasets that follow.
Each dataset contains a single decimal integer, the width, W, of the grid for this problem instance.
Output
For each problem instance, there is one line of output: The problem instance number as a decimal integer (start counting at one), a single space and the number of tilings of a 4byW grid. The values of W will be chosen so the count will fit in a 32bit integer.
Sample Input
3
2
3
7
Sample Output
1 5
2 11
3 781

回答 1 已采纳 Description
Ms. Iyo KiffaAustralis has a balance and only two kinds of weights to measure a dose of medicine. For example, to measure 200mg of aspirin using 300mg weights and 700mg weights, she can put one 700mg weight on the side of the medicine and three 300mg weights on the opposite side (Figure 1). Although she could put four 300mg weights on the medicine side and two 700mg weights on the other (Figure 2), she would not choose this solution because it is less convenient to use more weights.
You are asked to help her by calculating how many weights are required.
![](http://poj.org/images/2142_1.jpg)
Input
The input is a sequence of datasets. A dataset is a line containing three positive integers a, b, and d separated by a space. The following relations hold: a != b, a <= 10000, b <= 10000, and d <= 50000. You may assume that it is possible to measure d mg using a combination of a mg and b mg weights. In other words, you need not consider "no solution" cases.
The end of the input is indicated by a line containing three zeros separated by a space. It is not a dataset.
Output
The output should be composed of lines, each corresponding to an input dataset (a, b, d). An output line should contain two nonnegative integers x and y separated by a space. They should satisfy the following three conditions.
You can measure dmg using x many amg weights and y many bmg weights.
The total number of weights (x + y) is the smallest among those pairs of nonnegative integers satisfying the previous condition.
The total mass of weights (ax + by) is the smallest among those pairs of nonnegative integers satisfying the previous two conditions.
No extra characters (e.g. extra spaces) should appear in the output.
Sample Input
700 300 200
500 200 300
500 200 500
275 110 330
275 110 385
648 375 4002
3 1 10000
0 0 0
Sample Output
1 3
1 1
1 0
0 3
1 1
49 74
3333 1

qq_41895190的博客 pytorch版yolov3训练自己数据集 目录 1. 环境搭建 2. 数据集构建 3.... 4.... 5.... 6.... 7....将github库download下来。 git clone https://github.com/ultralytics/yolov3.git 建议在linux环境下使用anaconda... 
Arrow的博客 转自：...SOTA: stateoftheart Introduction The key to getting better at deep learning (or most fields in... 
yuanchunjian的博客 from __future__ import print_function from PIL import Image import os import os.path import numpy as np import sys if sys.version_info[0] == 2: import cPickle as pickle else: import pickle ... 
GarfieldEr007的博客 The Deep Learning Gold Rush of 2015 In the last few decades, we have witnessed major technological innovations such as personal computers and the internet finally reach the mainstream. And wi 
weixin_30819163的博客 实现一个定制的 Dataset 类 Dataset 类是 PyTorch 图像数据集中最为重要的一个类，也是 PyTorch 中所有数据集加载类中应该继承的父类。其中，父类的两个私有成员函数必须...Datasets 的框架： class CustomDataset(... 
LIQING LIN的博客 13_Loading and Preprocessing Data from multiple CSV with TensorFlow_custom training loop_TFRecordhttps://blog.csdn.net/Linli522362242/article/details/107704824 13_Loading and Preprocessing Data from ... 
名字填充中的博客 文章目录HuggingFace Datasets上传本地文件作为训练数据前言编写数据集加载脚本（Writing a dataset loading script）添加数据集元数据（Adding dataset metadata）下载数据文件并组织拆分(Downloading data files ... 
mtj66的博客 https://blog.algorithmia.com/deepdiveintoobjectdetectionwithopenimagesusingtensorflow/ 在Open Images数据集上使用TensorFlow进行Object Detection...Deep Dive into Object Detection with Open Im 
LIQING LIN的博客 So far we have used only datasets that fit in memory, but Deep Learning systems are often trained on very large datasets that will not fit in RAM. Ingesting a large dataset and preprocessing it ... 
GarfieldEr007的博客 The CIFAR10 and CIFAR100 are labeled subsets of the 80 million tiny images dataset. They were collected by Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. The CIFAR10 dataset The CIFAR10 ... 
凌风探梅的博客 Multivariate Time Series Forecasting with LSTMs in Keras By Jason Brownlee on August 14, 2017 in Deep Learning for Time Series Neural networks like Long ShortTerm Memory (LSTM) recurrent neural ... 
q79969786的博客 “The next version of MapReduce” from Facebook, based in own fork of Hadoop. The current Hadoop implementation of the MapReduce technique uses a single job tracker, which causes scaling issues for ... 
weixin_30284355的博客 from http://www.codeproject.com/csharp/zedgraph.asp内容好多~ Download source files (.Ne...