快速置零 xor %eax, %eax
在<<Linux 内核完全注释>>里面看到了几次xor ax, ax,很想不通,为什么不直接用mov ax, 0呢?今日到网上一搜才知道,我的天啊,xor ax, ax 只需要计算机2条指令,而mov ax, 0会消耗计算机5指令,什么意思?就是近三倍的速度差别。
[……]
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 Fractions to Decimals 分数化小数 解题报告
Fractions to Decimals
Write a program that will accept a fraction of the form N/D, where N is the numerator and D is the denominator and print the decimal representation. If the decimal representation has a repeating sequence of digits, indicate the sequence b[……]
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[……]