⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prob_b.html

📁 acm大赛题
💻 HTML
字号:
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.03 [zhcn] (Win95; I) [Netscape]">
   <TITLE>1991 ACM Finals, Problem B - Triangular Vertices</TITLE>
<!SGML "ISO 8879:1986">
<LINK HREF="mailto:karree46@sol.acs.uwosh.edu" REV=made>
</HEAD>
<BODY BGCOLOR="#FFFFFF">

<HR NOSHADE>
<CENTER>
<H2>
<I>1991 ACM Scholastic Programming Contest Finals</I></H2></CENTER>

<CENTER>
<H4>
<I>sponsored by AT&amp;T Computer Systems</I></H4></CENTER>

<CENTER>
<H2>
Problem B<BR>
Triangular Vertices</H2></CENTER>
Consider the points on an infinite grid of equilateral triangles as shown
below:
<BR><I><A HREF="trimatrix.txt">click here for text rendering</A></I>
<CENTER><IMG SRC="trimatrix.gif" ALT="matrix" ></CENTER>
&nbsp;

<P>Note that if we number the points from left to right and top to bottom,
then groups of these points form the vertices of certain geometric shapes.
For example, the sets of points {1,2,3} and {7,9,18} are the vertices of
triangles, the sets {11,13,26,24} and {2,7,9,18} are the vertices of parallelograms,
and the sets {4,5,9,13,12,7} and {8,10,17,21,32,34} are the vertices of
hexagons.

<P>Write a program which will repeatedly accept a set of points on this
triangular grid, analyze it, and determine whether the points are the vertices
of one of the following "acceptable" figures: triangle, parallelogram,
or hexagon. In order for a figure to be acceptable, it must meet the following
two conditions:
<OL>
<LI>
Each side of the figure must coincide with an edge in the grid.</LI>

<LI>
All sides of the figure must be of the same length.</LI>
</OL>

<H3>
Input and Output</H3>
The input will consist of an unknown number of point sets. Each point set
will appear on a separate line in the file. There are at most six points
in a set and the points are limited to the range 1..32767.

<P>For each point set in the input file, your program should deduce from
the number of points in the set which geometric figure the set potentially
represents; e.g., six points can only represent a hexagon, etc. The output
must be a series of lines listing each point set followed by the results
of your analysis.
<H3>
Sample Input</H3>

<PRE>1 2 3&nbsp;&nbsp;&nbsp;
11 13 29 31
26 11 13 24
4 5 9 13 12 7
1 2 3 4 5
47&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
11 13 23 25</PRE>

<H3>
Sample Output</H3>

<PRE>1 2 3 are the vertices of a triangle
11 13 29 31 are not the vertices of an acceptable figure
26 11 13 24 are the vertices of a parallelogram
4 5 9 13 12 7 are the vertices of a hexagon
1 2 3 4 5 are not the vertices of an acceptable figure
47 are not the vertices of an acceptable figure
11 13 23 25 are not the vertices of an acceptable figure</PRE>

<HR NOSHADE>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -