ACM题目

2026/1/25 6:10:35

Output

每个测试例对应一行输出,含一个实数,表示半径的值,若无解则输出“NO”。

Sample Input

2 1000 3000

Sample Output

2.1 NO

1159: Triangle

Time Limit: 1500 ms Memory Limit: 10000 kB

Total Submit : 215 (63 users) Accepted Submit : 69 (60 users) Page View : 2309

Font Style: Aa Aa Aa

A lattice point is an ordered pair (x, y) where x and y are both integers. Given the coordinates of the vertices of a triangle (which happen to be lattice points), you are to count the number of lattice points which lie completely inside of the triangle (points on the edges or vertices of the triangle do not count).

Input

The input test file will contain multiple test cases. Each input test case consists of six integers x1,

y1, x2, y2, x3, and y3, where (x1, y1), (x2, y2), and (x3, y3) are the coordinates of vertices of the

triangle. All triangles in the input will be non-degenerate (will have positive area), and ?15000 ≤ x1, y1, x2, y2, x3, y3 ≤ 15000. The end-of-file is marked by a test case with x1 =y1 = x2 = y2 =

x3 = y3 = 0 and should not be processed.

Output

For each input case, the program should print the number of internal lattice points on a single line.

Sample Input

0 0 1 0 0 1 0 0 5 0 0 5 0 0 0 0 0 0

Sample Output

0 6

1177: Rectangles

Time Limit: 9000 ms Memory Limit: 10000 kB

Total Submit : 105 (38 users) Accepted Submit : 46 (33 users) Page View : 1950

Font Style: Aa Aa Aa

A specialist in VLSI design testing must decide if there are some components that cover each other for a given design. A component is represented as a rectangle. Assume that each rectangle is rectilinearly oriented (sides parallel to the x and y axis), so that the representation of a rectangle consists of its minimum and maximum x and y coordinates.

Write a program that counts the rectangles that are entirely covered by another rectangle.

Input

The input contains the text description of several sets of rectangles. The specification of a set consists of the number of rectangles in the set and the list of rectangles given by the minimum and maximum x and y coordinates separated by white spaces, in the format:

nr_rectangles

xmin1 xmax1 ymin1 ymax1 xmin2 xmax2 ymin2 ymax2 ...

xminn xmaxn yminn ymaxn

For each set,there will be less than 5000 rectangles.

Output

The output should be printed on the standard output. For each given input data set, print one integer number in a single line that gives the result (the number of rectangles that are covered).

Sample Input

3

100 101 100 101 0 3 0 101 20 40 10 400 4

10 20 10 20 10 20 10 20 10 20 10 20 10 20 10 20

Sample Output

0 4

1200: Euclid's Game

Time Limit: 1500 ms Memory Limit: 10000 kB

Total Submit : 185 (46 users) Accepted Submit : 59 (42 users) Page View : 1871

Font Style: Aa Aa Aa

Two players, Stan and Ollie, play, starting with two natural numbers. Stan, the first player, subtracts any positive multiple of the lesser of the two numbers from the greater of the two numbers, provided that the resulting number must be nonnegative. Then Ollie, the second player, does the same with the two resulting numbers, then Stan, etc., alternately, until one player is able to subtract a multiple of the lesser number from

the greater to reach 0, and thereby wins. For example, the players may start with (25,7):

25 7

11 7 4 7 4 3 1 3 1 0

an Stan wins.

Input

The input consists of a number of lines. Each line contains two positive integers giving the starting two numbers of the game. Stan always starts.

Output

For each line of input, output one line saying either Stan wins or Ollie wins assuming that both of them play perfectly. The last line of input contains two zeroes and should not be processed.

Sample Input

34 12 15 24 0 0

Sample Output

Stan wins Ollie wins

1215: 小鼠迷宫问题

Time Limit: 1500 ms Memory Limit: 10000 kB

Judge type: Multi-cases

Total Submit : 180 (45 users) Accepted Submit : 60 (36 users) Page View : 3340

Font Style: Aa Aa Aa

小鼠a与小鼠b身处一个m×n的迷宫中,如图所示。每一个方格表示迷宫中的一个房间。这m×n个房间中有一些房间是封闭的,不允许任何人进入。在迷宫中任何位置均可沿上,下,左,右4个方向进入未封闭的房间。小鼠a位于迷宫的(p,q)方格中,它必须找出一条通向小鼠b所在的(r,s)方格的路。请帮助小鼠a找出所有通向小鼠b的最短道路。

编程任务

对于给定的小鼠的迷宫,编程计算小鼠a通向小鼠b的所有最短道路。

Input

本题有多组输入数据,你必须处理到EOF为止。

每组数据的第一行有3个正整数n,m,k,分别表示迷宫的行数,列数和封闭的房间数。接下来的k行中,每行2个正整数,表示被封闭的房间所在的行号和列号。最后的2行,每行也有2个正整数,分别表示小鼠a所处的方格(p,q)和小鼠b所处的方格(r,s)。

Output


ACM题目.doc 将本文的Word文档下载到电脑
搜索更多关于: ACM题目 的文档
相关推荐
相关阅读
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 10

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xuecool-com QQ:370150219