
回答 1 已采纳 Problem Description
Traveling through hyperspace is a risky thing, considering the fact that there are many stars, asteroids, (and possibly black holes!) out in the galaxy, and without careful planning, it’s so easy to end up thousands of lightyears from your planned destination. Therefore people who don’t like uncertainty tend to avoid hyperspace traveling. However, as we need to travel through an unknown sector to attend the ACM/ICPC world final in the year 3007, and you’re the most experienced navigator and programmer we can find, it is unfortunately your responsibility to plan a journey that will lead us across the sector.
It is know that there are several strange asteroids in the sector – every one of them is generating gravity anomaly in a circular area with a fixed radius around the asteroid. One particular position’s abnormality value is equal to the number of asteroids affecting that position.
You decided that you will follow one simple rule during your travel – that is, you will always fly your ship along the gravity range boundary of one or more asteroids. Nevertheless, the possibility of failure remains due to the unpredictable nature of gravity anomaly, therefore you also want to minimize the absolute difference between the maximum abnormality value and the minimum abnormality value on your flight path. For simplicity, you can assume that all asteroids (as well as your flight path) will be on the plane Z = 0. Can you find the minimum absolute value with the help of your computer?
Input
There are multiple test cases in the input file. Each test case starts with one integer N (2 = 1), indicating that there is an asteroid at position (X, Y) with gravity range R.
There is a blank line after each test case. N = 0 indicates the end of input file and should not be processed by your program.
It is guaranteed that the input data is always legal, i.e. both your starting position and your destination are on the boundary of one or more asteroids, no two asteroids will have 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.
Output
For each test case, output one integer on one separate line as requested. If there is no way for you to reach the destination by only flying along asteroids’ gravity range boundaries, output 1 instead.
Sample Input
2
1.000 0.000 1.000 0.000
0.000 0.000 1.000
1.000 0.000 1.000
2
1.000 0.000 5.000 0.000
1.000 1.000 1.000
4.000 0.000 1.000
0
Sample Output
Case 1: 1
Case 2: 1

回答 1 已采纳 Problem Description
Traveling through hyperspace is a risky thing, considering the fact that there are many stars, asteroids, (and possibly black holes!) out in the galaxy, and without careful planning, it’s so easy to end up thousands of lightyears from your planned destination. Therefore people who don’t like uncertainty tend to avoid hyperspace traveling. However, as we need to travel through an unknown sector to attend the ACM/ICPC world final in the year 3007, and you’re the most experienced navigator and programmer we can find, it is unfortunately your responsibility to plan a journey that will lead us across the sector.
It is know that there are several strange asteroids in the sector – every one of them is generating gravity anomaly in a circular area with a fixed radius around the asteroid. One particular position’s abnormality value is equal to the number of asteroids affecting that position.
You decided that you will follow one simple rule during your travel – that is, you will always fly your ship along the gravity range boundary of one or more asteroids. Nevertheless, the possibility of failure remains due to the unpredictable nature of gravity anomaly, therefore you also want to minimize the absolute difference between the maximum abnormality value and the minimum abnormality value on your flight path. For simplicity, you can assume that all asteroids (as well as your flight path) will be on the plane Z = 0. Can you find the minimum absolute value with the help of your computer?
Input
There are multiple test cases in the input file. Each test case starts with one integer N (2 = 1), indicating that there is an asteroid at position (X, Y) with gravity range R.
There is a blank line after each test case. N = 0 indicates the end of input file and should not be processed by your program.
It is guaranteed that the input data is always legal, i.e. both your starting position and your destination are on the boundary of one or more asteroids, no two asteroids will have 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.
Output
For each test case, output one integer on one separate line as requested. If there is no way for you to reach the destination by only flying along asteroids’ gravity range boundaries, output 1 instead.
Sample Input
2
1.000 0.000 1.000 0.000
0.000 0.000 1.000
1.000 0.000 1.000
2
1.000 0.000 5.000 0.000
1.000 1.000 1.000
4.000 0.000 1.000
0
Sample Output
Case 1: 1
Case 2: 1

回答 1 已采纳 Description
The Advancement of Collegiate Mastermind (hey, that's ACM again...weird!) is an organization which (among other things) holds classes for college students to improve their Mastermind skills. Recall that basic Mastermind is a twoplayer game which works as follows: The first player – the codemaker – creates a secret 4color code, each color taken from one of six colors (we'll use A, B, C, D, E and F for the colors). The other player – the codebreaker – now must try to guess the codemaker's code. After each guess, the codemaker uses black and white pegs to tell the codebreaker two things: the number of correct colors in the correct positions (the black pegs), and the number of remaining correct colors that are in the wrong positions (the white pegs). For example, if the true code is ABCC, and the codebreaker makes the guess ACCD, then the response would be 2 black and 1 white; if the guess was CCAA, the response would be 3 white. The codebreaker continues making guesses until he receives 4 blacks. More advanced versions of Mastermind increase both the length of the code and the number of colors to choose from.
The ACM's master instructor is Dee Sifer, and she has a unique ability: when given a set of n guesses and responses, she can immediately determine what the best (n + 1)st guess should be. For each possible (n + 1)st guess, Dee calculates (in her head) the number of codes left for each possible response she could get to that guess. The maximum of these numbers over all responses is called the uncertainty of the guess. The "best" guess is the one with the minimum uncertainty. For example, suppose that you get to a point in a game where you've narrowed down the answer to only three possible codes: ABBB, ABBC or ABCB. If your next guess is ABBB, there would be two possible responses: 4 blacks (leaving 0 remaining possibilities left) or 3 blacks (leaving 2 remaining possibilities – ABBC and ABCB). However, if instead of ABBB you try ABBC, then there are 3 possible responses: 4 blacks (leaving 0 possibilities), 3 blacks (leaving 1 possibility – ABBB) and 2 blacks and 2 whites (also leaving 1 possibility – ABCB). Thus ABBC would be a better guess in this case, since the uncertainty it leaves is 1, whereas the uncertainty for ABBB is 2.
This is all well and good, except for one thing. You have been selected as Dee's successor, and you do NOT have Dee's ability to pick the minimum uncertainty guess. Dee has been dropping hints (in code) that she plans to retire soon, so you need a program to help you simulate her ability.
Input
Input will consist of multiple test cases. The first line of the input file will contain a single integer indicating the number of test cases. Each test case will consist of several lines. The first line will contain three integers: l c n, where l is the length of the code being guessed, c is the number of colors to choose from, and n is the number of guesses made so far. These values will satisfy 1 ≤ l ≤ 15, 1 ≤ c ≤ 20, 0 ≤ n ≤ 10. The values of l and c will be such that the total possible number of codes will be 32768. After this will come n lines of the form :
guess b w
where guess is a lengthl character string specifying a guess, and b and w are the number of black and white pegs in the response. All colors will be uppercase letters taken from the first c letters of the alphabet. For each test case, the guesses given will limit the total number of possible solutions to 1500.
Output
For each test case, output a single line containing the best guess and its uncertainty. Use a single blank to separate the guess from the uncertainty. If there is more than one guess with the same minimum uncertainty, use the one which comes first lexicographically.
Sample Input
3
4 6 2
AABC 1 2
BEAC 0 3
4 6 1
ABCD 0 0
3 20 4
ABE 1 0
ROM 1 0
INK 1 0
MOB 0 2
Sample Output
ABCD 4
AEEE 3
IBM 0

回答 1 已采纳 Recently, the term Biometrics been used to refer to the emerging field of technology devoted to identification of individuals using biological traits, such as those based on retinal or iris scanning, fingerprints, or face recognition.
A simple biometric system translates a human image into a polygon by considering certain features (eyes, nose, ears, etc.) to be vertices and connecting them with line segments. The polygon has distinct vertices but may be degenerate in that the line segments could intersect. Because these polygons are generally created from remote images, there is some uncertainty as to their scale and rotation. Your job is to determine whether or not two polygons are similar; that is, can they be made equal by repositioning, rotating and magnifying them?
Input
Input consists of several test cases. Each test case consists of three lines containing:
f, the number of features
f coordinate pairs giving the vertices of the first polygon
f coordinate pairs giving the vertices of the second polygon
The vertices for both polygons correspond to the same set of features in the same order; for example, right ear tip, chin cleft, right eye, nose, left eye, left ear tip, space between front teeth. Each polygon has f distinct vertices; each vertex is given as an x and y coordinate pair. There are at least three and no more than ten features. Coordinates are integers between 1000 and 1000. A line containing 0 follows the last test case.
Output
For each case, output a line "similar" or "dissimilar" as appropriate. The two polygons are similar if, after some combination of translation, rotation, and scaling (but not reflection) both vertices corresponding to each feature are in the same position.
Sample Input
4
0 0 0 1 1 1 1 0
0 1 1 0 0 1 1 0
3
0 0 10 0 10 10
0 0 10 0 10 10
3
0 0 10 10 20 20
0 0 11 11 22 22
3
0 0 10 10 20 20
0 0 11 11 20 20
0
Sample Output
similar
dissimilar
similar
dissimilar

回答 2 已采纳 Information Theory is one of the most popular courses in Marjar University. In this course, there is an important chapter about information entropy.
Entropy is the average amount of information contained in each message received. Here, a message stands for an event, or a sample or a character drawn from a distribution or a data stream. Entropy thus characterizes our uncertainty about our source of information. The source is also characterized by the probability distribution of the samples drawn from it. The idea here is that the less likely an event is, the more information it provides when it occurs.
Generally, "entropy" stands for "disorder" or uncertainty. The entropy we talk about here was introduced by Claude E. Shannon in his 1948 paper "A Mathematical Theory of Communication". We also call it Shannon entropy or information entropy to distinguish from other occurrences of the term, which appears in various parts of physics in different forms.
Named after Boltzmann's Htheorem, Shannon defined the entropy Η (Greek letter Η, η) of a discrete random variable X with possible values {x1, x2, ..., xn} and probability mass function P(X) as:
\Large H(X)=E(\ln(P(x)))
Here E is the expected value operator. When taken from a finite sample, the entropy can explicitly be written as
\Large H(X)=\sum_{i=1}^{n}P(x_i)\log_{~b}(P(x_i))
Where b is the base of the logarithm used. Common values of b are 2, Euler's number e, and 10. The unit of entropy is bit for b = 2, nat for b = e, and dit (or digit) for b = 10 respectively.
In the case of P(xi) = 0 for some i, the value of the corresponding summand 0 logb(0) is taken to be a wellknown limit:
\Large 0 \log_{~b}(0) = \lim_{p \to 0 +} p \log_{~b} (p)
Your task is to calculate the entropy of a finite sample with N values.
Input
There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:
The first line contains an integer N (1 <= N <= 100) and a string S. The string S is one of "bit", "nat" or "dit", indicating the unit of entropy.
In the next line, there are N nonnegative integers P1, P2, .., PN. Pi means the probability of the ith value in percentage and the sum of Pi will be 100.
Output
For each test case, output the entropy in the corresponding unit.
Any solution with a relative or absolute error of at most 108 will be accepted.
Sample Input
3
3 bit
25 25 50
7 nat
1 2 4 8 16 32 37
10 dit
10 10 10 10 10 10 10 10 10 10
Sample Output
1.500000000000
1.480810832465
1.000000000000

回答 2 已采纳
What is the exact order of object deconstruction?
From testing, I have an idea: FIFO for the current scope.
class test1
{
public function __destruct()
{
echo "test1
";
}
}
class test2
{
public function __destruct()
{
echo "test2
";
}
}
$a = new test1();
$b = new test2();
Which produces the same results time and time again:
test1
test2
The PHP manual is vague (emphasis mine to highlight uncertainty): "The destructor method will be called as soon as there are no other references to a particular object, or in any order during the shutdown sequence."
What is the exact order of deconstruction? Can anyone describe in detail the implementation of destruction order that PHP uses? And, if this order is not consistent between any and all PHP versions, can anyone pinpoint which PHP versions this order changes in?

bryanjackie的博客 It told the world that matter can be converted into energy  and a lot of it  since the speed of light squared (c2) is a huge number. We've witnessed this equation's consequences in the devastating ... 
HenryQWER的博客 备注1：每个视频的英文字幕，都翻译成中文，太消耗时间了，为了加快学习进度，我将暂停这个工作，仅对英文字幕做...Dealing with Uncertainty Through Probability 你可以学到什么： 概率：小猪游戏。 最大化期... 
zhangrelay的博客 课程链接：http://underactuated.csail.mit.edu/Spring2019/ ...欠驱动机器人学Underactuated Robotics Algorithms for Walking, Running, Swimming, Flying, and Manip... 
dbLenis的博客 Magic Quadrant for Business Intelligence Platforms 6 February 2012 ID:G00225500 Analyst(s): John Hagerty, Rita L. Sallam, James Richardson ...In 2011, business 
weixin_26713521的博客 In fact, it did a great job considering the fact that earth is so huge and it’s able to pinpoint your location, with a small error radius which is represented by a circle around the point.... 
weixin_38169562的博客 100 the be and of a in to have it I that for you he with on do say this ...position player agree especially record pick wear paper special space ground form support event official whose matter everyone ... 
li936069140的博客 CHAPTER I Chinese THERE was no possibility of taking a walk that day. We had been wandering, indeed, in the leafless shrubbery an hour in the morning; but since dinner (Mrs. Reed, when there was 
RobotG的博客 Hans Moravec，占用栅格地图的发明人。 Obstacle Avoidance and Navigation in the Real World by a Seeing Robot Rover Hans Moravec March 1980 Computer Science Department ...(Ph.D....The Stanford AI lab ... 
xak的博客 is a closed source software and as such, there is some amount of uncertainty and speculation. However, I was able to get in touch with an old colleague working at Unity to clarify what happens... 
cumichun6193的博客 kennedy elliott showed us how preattentive processing of image attributes like color, shape, angles, position, curvature, volume, shading, area, length, and direction deeply impacts how humans ... 
枫笛雨声的博客 I grew up as a huge sports fan and then before I wrote papers on sports gambling I did a lot of sports gambling myself and although sports gambling was really, really fun, the problem with it was ... 
yinizhilianlove的博客 Liu link: https://openreview.net/pdf?id=HJgCF0VFwr Code: None Abstract: Deep neural networks (DNNs) can be huge in size, requiring a considerable a mount of energy and computational resources to ... 
weixin_30480651的博客 "There's a huge difference and a huge diversity of water transport strategies in trees." William Anderegg is an ecologist at the University of Utah. "It's everything from having deeper roots or ... 
cout0的博客 MerriamUnit.1BENEAMBELLPACPROBGRAVLEVWords from Mythology[^mythology] and HistoryUnit.2 Unit.1 BENE BENE is Latin for “well”. benediction A prayer that asks for God’s blessing, especially a prayer...