跳至正文

USACO 3.1 Shaping Regions 形成的区域 解题报告

这题二话不说, 用map[i][j]表示坐标为i, j的点是什么颜色的.. 很快就写出来了, 但是内存超过了,, 内存最多16MB.
没办法, 只好另辟思路, 但是在数据压缩方面我又很弱, 就看标程也花了两三天的时间, 今天终于是看懂了..
用rect记录所有矩形的坐标以及相应的颜色.
程序具体的步骤如下:

输入A, B, N. 记录第一个矩形: (0, 0) (A, B), 颜色为1
接着读入其余的矩形, 设当前是第i个
对i之前所有的矩形迭代, 此时迭代到的是第j个.
判断i是否完全包含j, 即: i.x1[……]

继续阅读

USACO 3.1 Humble Numbers 丑数 解题报告

从这一题开始,, 以后题目我就不贴上来了… 自己去看吧..

这一题开始肯本看不懂,, 后来是反反复复看标程看懂了..

首先要理解这么一个式子吧(算是式子吧“)

已经求出了j-1个丑数,, 现在求第j个丑数

对于每一个素数p乘以一个最小的丑数, 能使积大于第j-1个丑数

在这些乘积中寻找最小的一个即位第j个丑数.

用pindex[i]表示对于第i个素数乘以的最小丑数是多少..

/*
LANG: C
ID: zqy11001
PROG: humble
*/
#include 
#include 
#d[......]

继续阅读

USACO 3.1 Score Inflation 总分 解题报告

Score Inflation

The more points students score in our contests, the happier we here at the USACO are. We try to design our contests so that people can score as many points as possible, and would like your assistance.

We have several categories from which probl[……]

继续阅读

USA 3.1 Agri-Net 最短网络 解题报告

Agri-Net
Russ Cox
Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course.

Farmer John ordered a high speed connection for his farm and is going to[……]

继续阅读

USACO 2.4 Bessie Come Home 回家 解题报告

Bessie Come Home
Kolstad & Burch
It’s dinner time, and the cows are out in their separate pastures. Farmer John rings the bell so they will start walking to the barn. Your job is to figure out which one cow gets to the barn first (the supplied test data wi[……]

继续阅读

USACO Longest Prefix最长前缀 解题报告

Longest Prefix
IOI’96
The structure of some biological objects is represented by the sequence of their constituents denoted by uppercase letters. Biologists are interested in decomposing a long sequence into shorter ones called primitives.

We say that a sequen[……]

继续阅读

USACO 2.3 Zero Sum 零的算式和 解题报告

Zero Sum

Consider the sequence of digits from 1 through N (where N=9) in increasing order: 1 2 3 … N.

Now insert either a ‘+’ for addition or a ‘-‘ for subtraction or a ‘ ‘ [blank] to run the digits together between each pair of digits (not in front of the f[……]

继续阅读

USACO 2.3 Cow Pedigrees 奶牛家谱 解题报告

Farmer John is considering purchasing a new herd of cows. In this new herd, each mother cow gives birth to two children. The relationships among the cows can easily be represented by one or more binary trees with a total of N (3 <= N < 200) nodes. The tr[……]

继续阅读

USACO 2.3 Money Systems 货币系统 解题报告

Money Systems

The cows have not only created their own government but they have chosen to create their own money system. In their own rebellious way, they are curious about values of coinage. Traditionally, coins come in values like 1, 5, 10, 20 or 25, 50, and[……]

继续阅读