
编程
文章平均质量分 85
z_ert
这个作者很懒,什么都没留下…
展开
-
素数统计.
这几天围着素数统计这一题就把我搞蒙了.. 题目是这样的: 输入一个整数n, 输出小于等于n的素数个数.. 刚开始, 觉得题目挺容易的,, 马上写了一个程序出来, 测试了一下, 结果没错.. 急急忙忙的就提交了,, 后来再把题目仔细看了看,, n的范围是1~二百万.. 时间要求时1s. 我自信的敲入了两百万.. 结果十分钟才把结果蹦出来... 我这么没用啊,,, 时间要求1s,, ...2010-03-16 12:12:37 · 139 阅读 · 0 评论 -
USACO 2.4 Bessie Come Home 回家
Bessie Come HomeKolstad & 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 whic...2010-03-27 13:01:48 · 245 阅读 · 0 评论 -
USACO 2.4 Fractions to Decimals 分数化小数
Fractions to DecimalsWrite 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 representat...2010-03-27 15:47:53 · 187 阅读 · 0 评论 -
USA 3.1 Agri-Net 最短网络
Agri-NetRuss 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...2010-03-27 20:14:52 · 144 阅读 · 0 评论 -
USACO 3.1 Score Inflation 总分
Score InflationThe 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 li...2010-03-27 20:19:07 · 204 阅读 · 0 评论 -
USACO 3.1 Humble Numbers 丑数
从这一题开始,, 以后题目我就不贴上来了... 自己去看吧.. 这一题开始肯本看不懂,, 后来是反反复复看标程看懂了.. 首先要理解这么一个式子吧(算是式子吧``) 已经求出了j-1个丑数,, 现在求第j个丑数 对于每一个素数p乘以一个最小的丑数, 能使积大于第j-1个丑数 在这些乘积中寻找最小的一个即位第j个丑数. 用pindex[i]表示对于第i...2010-03-28 15:31:49 · 148 阅读 · 0 评论 -
USACO 3.1 Shaping Regions 形成的区域
这题二话不说, 用map[i][j]表示坐标为i, j的点是什么颜色的.. 很快就写出来了, 但是内存超过了,, 内存最多16MB. 没办法, 只好另辟思路, 但是在数据压缩方面我又很弱, 就看标程也花了两三天的时间, 今天终于是看懂了.. 用rect记录所有矩形的坐标以及相应的颜色. 程序具体的步骤如下: 输入A, B, N. 记录第一个矩形: (0, 0) (A...2010-03-30 20:01:04 · 409 阅读 · 0 评论 -
重做 USACO 1.1 你的飞碟在这儿
不解释了..[code="C"]/*LANG: CID: zqynux11PROG: ride*/#include #define loop(i, j)\p = i;\while(*p != '\0'){\ j *= *p - 'A' + 1;\ p++;\}/* 之前将p++掉了.. */int main(void){ ch...2010-03-31 18:56:33 · 159 阅读 · 0 评论 -
重做 USACO 1.1 贪婪的送礼者
这题的话, 我用的是个结构体, 记录各个人.. 我错了的地方我注释了`[code="C"]/*LANG: CID: zqynux11PROG: gift1*/#include #include struct people{ char name[15]; int given, got;}pep[10];int np;int find(c...2010-03-31 18:58:09 · 165 阅读 · 0 评论 -
重做 USACO 1.1 黑色星期五
解释什么的就算了吧,, [code="C"]/*LANG: CID: zqynux11PROG: friday*/#include #include int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};int week[7];int main(void){ int...2010-03-31 18:59:05 · 131 阅读 · 0 评论 -
USACO 2.4 Cow Tours 牛的旅行
Cow ToursFarmer John has a number of pastures on his farm. Cow paths connect some pastures with certain other pastures, forming a field. But, at the present time, you can find at least two pasture...2010-03-27 11:57:32 · 139 阅读 · 0 评论 -
USACO 2.4 Overfencing 穿越栅栏
USACO 2.4 Overfencing 穿越栅栏OverfencingKolstad and Schrijvers Farmer John went crazy and created a huge maze of fences out in a field. Happily, he left out two fence segments on the edges, and thu...2010-03-25 18:18:11 · 433 阅读 · 0 评论 -
USACO 2.4 The Tamworth Two 两只塔姆沃斯牛
The Tamworth TwoBIO '98 - Richard Forster A pair of cows is loose somewhere in the forest. Farmer John is lending his expertise to their capture. Your task is to model their behavior. The chas...2010-03-23 22:05:43 · 284 阅读 · 0 评论 -
Packing Rectangles 铺放矩形块 (IOI 95)
Packing Rectangles 铺放矩形块 (IOI 95)在网上看了挺多解释这一题的文章,总感觉没看大懂,所以自己写一篇文章吧。希望能够帮助大家理解一下这一题。题目如下:http://www.nocow.cn/index.php/Translate:USACO/packrec 开始拿到题目确实没怎么看懂,网上也有很多人说它是个水题,我倒感觉不以为然,我看了一...2010-03-16 12:16:18 · 422 阅读 · 0 评论 -
USACO 2.2 Subset Sums集合
USACO 2.2 Subset Sums集合 For many sets of consecutive integers from 1 through N (12010-03-16 12:18:49 · 227 阅读 · 0 评论 -
vijos 谁拿了最多奖学金
描述 Description 某校的惯例是在每学期的期末考试之后发放奖学金。发放的奖学金共有五种,获取的条件各自不同: 1) 院士奖学金,每人8000元,期末平均成绩高于80分(>80),并且在本学期内发表1篇或1篇以上论文的学生均可获得; 2) 五四奖学金,每人4000元,期末平均成绩高于85分(>85),并且班级评议成绩高于80分(>80)的学生均...2010-03-17 12:25:48 · 124 阅读 · 0 评论 -
USACO Longest Prefix最长前缀
Longest PrefixIOI'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 seq...2010-03-17 12:28:18 · 138 阅读 · 0 评论 -
USACO 2.3 Zero Sum 零的算式和
Zero SumConsider 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...2010-03-20 14:30:08 · 221 阅读 · 0 评论 -
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 binar...2010-03-21 15:02:05 · 236 阅读 · 0 评论 -
USACO 2.3 Money Systems 货币系统
Money SystemsThe 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. Tradi...2010-03-22 13:31:46 · 211 阅读 · 0 评论 -
USACO 1.1 Broken Necklace 破碎的项链
Broken NecklaceYou have a necklace of N red, white, or blue beads (32010-03-22 18:04:10 · 367 阅读 · 0 评论 -
USACO 2.3 Controlling Companies 控制公司
Controlling CompaniesSome companies are partial owners of other companies because they have acquired part of their total shares of stock. For example, Ford owns 12% of Mazda. It is said that a com...2010-03-23 22:00:02 · 264 阅读 · 0 评论 -
重做 USACO 1.1 黑色星期五
[code="C"]/*LANG: CID: zqynux11PROG: beads*/#include #include char ball[701];int main(void){ int max = 0; int a = 0, b = 0, w = 0; /* */ int i, n; char ch = '\0'; fre...2010-03-31 18:59:37 · 168 阅读 · 0 评论