05 2012 档案
计数问题—分治
摘要:给定两个数a和b,计算出1在a和b之间出现的次数。解题思路: 可以由分治算法的思想,先求出1在0~a中出现的次数,再求出1在0~b中出现的次数,然后两者相减即可。1#include<stdio.h>2intd[11];//d[n]存储数字0~9分别出现的次数。3intvalue;//记录相应的权值变化4voiddeal(intn)5{6if(n<=0)7return;8intone,ten;//one,ten分别代表个位和十位、9one=n%10;10n/=10;11ten=n;12inti;13for(i=0;i<one;i++)//将个位上出现的数统计下来14d[i 阅读全文
posted @ 2012-05-30 10:11 pony1993 阅读(356) 评论(0) 推荐(0) 编辑
POJ1125 Stockbroker Grapevine
摘要:Stockbroker GrapevineTime Limit:1000MSMemory Limit:10000KTotal Submissions:19965Accepted:10793DescriptionStockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactical edge in the st 阅读全文
posted @ 2012-05-25 21:06 pony1993 阅读(138) 评论(0) 推荐(0) 编辑
POJ3615 Cow Hurdles
摘要:Cow HurdlesTime Limit:1000MSMemory Limit:65536KTotal Submissions:4584Accepted:1990DescriptionFarmer John wants the cows to prepare for the county jumping competition, so Bessie and the gang are practicing jumping over hurdles. They are getting tired, though, so they want to be able to use as little 阅读全文
posted @ 2012-05-25 19:59 pony1993 阅读(216) 评论(0) 推荐(1) 编辑


< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8
Statcounter View My Stats
点击右上角即可分享
微信分享提示