BOJ
文章平均质量分 77
wyf5060060
这个作者很懒,什么都没留下…
展开
-
problem 1320(当时无法AC原因 没有对输入进行限制 如果输入100000(超过10^30)A,则会溢出重回一个比较小的数)
DescriptionRun-length encoding is a simple compression technique which compresses strings of letters by replacing repeated consecutive letters (called runs) by the number of occurrences of the letter, followed by that letter. For example, AAAABBBCDDE compr原创 2011-03-08 22:46:00 · 360 阅读 · 0 评论 -
boj 1343 汉诺塔 递归问题 谢谢大牛的解答 我需要多联系
<br />地址:http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1343<br /> <br /> Tower of HanoiSubmit: 115 Accepted:31Time Limit: 1000MS Memory Limit: 65535K<br />Description<br />The Tower of Hanoi is a puzzle consisting of three pegs(namead 1,原创 2011-03-24 23:16:00 · 292 阅读 · 0 评论 -
boj 1345 二叉树问题 简单的dp
<br />http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1345<br /> <br />1.从底向上复杂度比较低。<br />2.简单的dp应该熟悉。<br /> TravelSubmit: 349 Accepted:81Time Limit: 1000MS Memory Limit: 65536K<br />Description<br />Yicou经常旅游,但很可惜他不太喜欢旅游(人在江湖,身不由己阿~)所以,每次原创 2011-03-25 17:58:00 · 364 阅读 · 0 评论 -
boj 1336 简单的问题 不过自己没想到 别人解释的~~学习~~
<br />地址:http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1336<br /> AdventureSubmit: 72 Accepted:44Time Limit: 1000MS Memory Limit: 16384K<br />Description<br />Considering that our excellent ACM guys have devoted themselves so much so tha原创 2011-03-23 15:53:00 · 261 阅读 · 0 评论 -
boj 1336 简单的问题 不过自己没想到 别人解释的~~学习~~这个是 第二类Stirling数 需要再好好看看
地址:http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1336 AdventureSubmit: 72 Accepted:44Time Limit: 1000MS Memory Limit: 16384KDescriptionConsidering that our excellent ACM guys have devoted themselves so much so that they have little time原创 2011-03-23 16:56:00 · 339 阅读 · 0 评论 -
boj 1307 二叉树前序遍历
<br />地址:http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1307第三题:二叉树前序遍历Submit: 3319 Accepted:939Time Limit: 1000MS Memory Limit: 65535K<br />Description<br />给定一棵有n个结点的二叉树,结点的编号为0~n-1。请你编写程序输出二叉树的前序遍历序列。<br /><br />Input<br />输入的第一行是一个正整数原创 2011-03-28 15:32:00 · 462 阅读 · 0 评论 -
boj 1511 简单科学计算器 代码非常繁杂 思路不是特别好`
<br />地址:http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1511<br />1.进栈出栈操作不要闹混。<br />2.要用float类型,虽然最后结果一定为整数 但是中间数可能不是 比如3/2+3/2 不用float就是2 而用了float就是3.<br /> 科学计算器Submit: 3087 Accepted:617Time Limit: 1000MS Memory Limit: 65536K<br />Desc原创 2011-03-28 17:41:00 · 506 阅读 · 0 评论 -
boj 1338 simple game 先枚举行 然后对每一列再找 用到了不少位运算 另外数组要定义全局 局部数组不为0
地址:http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=13381. 12. 数组问题 暂时没弄清3. 先枚举行翻转的情况n行有2的n次方状态 然后再找列。 Simple GameSubmit: 84 Accepted:27Time Limit: 1000MS Memory Limit: 65535KDescriptionRecently, little White fell in love with a simple game原创 2011-03-26 22:17:00 · 307 阅读 · 0 评论 -
boj 1347 简单数组问题 在一个二维数组中 a[i][j]=a[i][j]+a[i-1][j]+a[i][j-1]-a[i-1][j-1] 则a[i][j]为i j位置左上侧所有元素之和
<br />http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1347<br /> <br />1. 在一个二维数组中 a[i][j]=a[i][j]+a[i-1][j]+a[i][j-1]-a[i-1][j-1] 则a[i][j]为i j位置左上侧所有元素之和the position of photo frameSubmit: 77 Accepted:27Time Limit: 2000MS Memory Limit: 655原创 2011-03-26 23:51:00 · 671 阅读 · 0 评论 -
boj 1344 复杂数问题
<br />地址: http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1344<br /> <br />1.对这类题,先选取他们的和 2*3*5*7*11*13=30030 数字是按规律出现的,每30030一个周期。<br />2.对字符串里的数字变成整形,temp=temp*10+a[i]-'0';<br />3.对某数取模,可以按上面的方法一位一位取模~<br /> <br />Description<br />Sunny认为,原创 2011-03-25 14:49:00 · 301 阅读 · 0 评论 -
boj 1306 简单问题 字符串直接存的就是ascii码
<br />地址:http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1306第二题:统计字母Submit: 6034 Accepted:1827Time Limit: 1000MS Memory Limit: 65535K<br />Description<br />给定一个只有小写英文字母组成的字符串,串长为n。请你编写程序求出这个字符串中出现次数最多的字母。<br /><br /><br />Input<br />输入的第一原创 2011-03-28 12:43:00 · 358 阅读 · 0 评论 -
boj 1517 2010年计算机院复试 哈弗曼编码
<br />题目大意(回忆版):哈夫曼树,第一行输入一个数n,表示叶结点的个数。需要用这些叶结点生成哈夫曼树,根据哈夫曼树的概念,这些结点有权值,即weight,题目需要输出所有结点的值与权值的乘积之和。 <br /> <br />Sample: <br /> <br />Input: <br />5 <br />1 2 2 5 9 <br /> <br />Output: <br />37 <br /> <br />解释:即生成如下图哈夫曼树,结点1的权值为4,结点2的权值为4,结点2的权值原创 2011-03-30 00:42:00 · 408 阅读 · 0 评论 -
boj 1202 分苹果问题 把苹果总数可以看成1+2+4.... 2的幂的和的形式
<br />用m个数表示1-n任意一个数,则可以考虑把n看成2的幂的和进行分解,m个数最多表示到2^m-1个数<br /> <br /> <br /> <br />地址:http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1202<br /> AppleAndBoxSubmit: 552 Accepted:254Time Limit: 1000MS Memory Limit: 65536K<br />Description<br原创 2011-04-01 17:13:00 · 435 阅读 · 0 评论 -
BOJ 1203 nimm游戏问题 参考别人思路 并且不是非常明白还
地址:http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1203 FunnyGame1Submit: 44 Accepted:17Time Limit: 1000MS Memory Limit: 65536KDescriptionAlice 和 Bob在玩一个叫357的游戏,游戏的布局如图一。游戏的规则很简单,在每一步时,当前的游戏者可以在当前的状态下选取某一行的若干个连续(至少1个)的没有被消去的环进行消去。当所有的环都被消去原创 2011-04-01 18:39:00 · 397 阅读 · 0 评论 -
boj 1204 让树的根结点到叶子结点等长的问题
<br />地址:http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1204EqualTreeSubmit: 105 Accepted:29Time Limit: 1000MS Memory Limit: 65536K<br />Description<br />给定一棵有根树,每条边上都有一个正的长度,现在你可以延长某些边的长度,使得所有的叶子结点到根的距离相等,并且延长的长度最小。<br /><br /><br /><br原创 2011-04-02 22:22:00 · 364 阅读 · 0 评论 -
boj 1209 魂斗罗 用简单dp解决问题
<br />1.dp[i][j]保存到i行j列元素的最大值<br />地址:http://boj.me/onlinejudge/showproblem.php?problem_id=1209<br /> 魂斗罗Star it! Submit: 781 Accepted:257Time Limit: 1000MS Memory Limit: 65536K<br />Description<br />游戏我小时候的最爱,相信也是大家的最爱。魂斗罗便是其中一种,可在我们为它疯狂之时,是否想过去了解更多有关它原创 2011-04-04 23:46:00 · 583 阅读 · 0 评论 -
数组循环右移算法
int a[n]; //原数组 int b[n]; //目标数组 k为向右移动位数 for(i=0;ib[i]=a[(i-k+n)%n];}转载 2012-02-26 17:23:46 · 358 阅读 · 0 评论 -
boj 1336 简单的问题 不过自己没想到 别人解释的~~学习~~
<br />地址:http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1336<br /> AdventureSubmit: 72 Accepted:44Time Limit: 1000MS Memory Limit: 16384K<br />Description<br />Considering that our excellent ACM guys have devoted themselves so much so tha原创 2011-03-23 16:03:00 · 303 阅读 · 0 评论 -
boj 1336 简单的问题 不过自己没想到 别人解释的~~学习~~
<br />地址:http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1336<br /> AdventureSubmit: 72 Accepted:44Time Limit: 1000MS Memory Limit: 16384K<br />Description<br />Considering that our excellent ACM guys have devoted themselves so much so tha原创 2011-03-23 16:02:00 · 365 阅读 · 0 评论 -
boj problem 1340 简单题 费时很久 long long型 输入输出时 "%lld“ 是LL而不是11. 先快排 然后计算就可以
<br />地址:http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1340The Noisy PartySubmit: 209 Accepted:50Time Limit: 1000MS Memory Limit: 65536K<br />Description<br />Nitaa is holding a party at his house. But unfortunately Nitaa has received a原创 2011-03-23 00:19:00 · 379 阅读 · 0 评论 -
boj problem 1323 读取字符串时候要考虑空格情况 用cin.getline(数组名,大小)
<br />#include<iostream><br />#include<string.h><br />using namespace std;<br />int main()<br />{<br /> int i,j,t,n=0,f,k;<br /> char a[255];<br /> char b[255];<br /> int total=1048576;<br /> while(cin>>t)<br /> {<br /> total=1048576;<br /> n=0;<br原创 2011-03-13 17:54:00 · 282 阅读 · 0 评论 -
boj problem 1326 冒泡的话复杂度太高 TLE错误。输入时就应该进行判断
<br />Description<br />There are N boxes on one straight line which is long enough. <br />They move at the same speed, but their directions may be different. That is, some boxes <br />may move left, while the others move right. As a beautiful girl fond of原创 2011-03-14 14:37:00 · 407 阅读 · 0 评论 -
boj problem 1325 一次ac~~哈哈 第一次~~
<br />Description<br />In IEEE 754-1985 standard, 32-bit single precision floating point number is stored as follows.<br />The highest bit is the sign bit, and following 8-bit is the exponent field, and 23-bit for fraction part:<br />s eeeeeeee mmmmmmmmmmm原创 2011-03-14 12:50:00 · 245 阅读 · 0 评论 -
boj problem 1331 思路:快排分块 按块查找 问题:全局数组时可以定义到500W的 main函数下的数组不行~ 另外c语言比c++快 TLE可以考虑C~~具体原因待解决
Arsenal与水杯之间的故事Submit: 1169 Accepted:189Time Limit: 1000MS Memory Limit: 65535K<br />Description<br />时间:某一天;<br />地点:915<br />ACM集训队刚刚做完个人赛,大家正在讨论长期重复使用塑料瓶的危害性,刚好这时候Arsenal4提着灌满了饮用水的塑料瓶进来,他听到我们的谈话后,慌了。通过一番谈话,集训队了解到,Arsenal4每天需要喝比较多的水,迫于无奈才使用这种容量足够大的塑料瓶原创 2011-03-17 14:50:00 · 788 阅读 · 1 评论 -
boj problem 1329 快速排序tle 堆排序还可以~~需要熟悉快速排序和堆排序~~静态数组全局下可以很大 但main下不行 具体看1331那篇
寻找相同Submit: 1738 Accepted:418Time Limit: 1000MS Memory Limit: 65535KDescription有一组数,很多很多个数,里面有一个数出现了超过一半次,请你把它找出来。Input先是一个N (NOutput对每个Case,输出一行,这一行只含有一个在之前数列中出现超过一半次的数。每个case之后输出一个空行。Sample Input11 5 5 5 5 5 5 1 2 3 4 6Sample OutputCase 1: 5Source#inc原创 2011-03-16 22:39:00 · 335 阅读 · 0 评论 -
boj 1328 简单问题 不过要考虑输入大小 long long可以 不过VC++不能编译
<br />agicpig and Acm like to compete with each other recently. The loser has to "BG" the winner, that means, if Magicpig wins, Acm will treat him <br />to a meal. But Acm is so powerful that Magicpig has to "BG" him almost every time. Everybody is very in原创 2011-03-16 12:48:00 · 379 阅读 · 0 评论 -
problem 1329 TLE的快速排序 有问题无法AC 检查后再改 先发上来
<br />Description<br />有一组数,很多很多个数,里面有一个数出现了超过一半次,请你把它找出来。<br /><br />Input<br />先是一个N (N<=400000),然后接下来一行N个数,多组数据输入。<br /><br />Output<br />对每个Case,输出一行,这一行只含有一个在之前数列中出现超过一半次的数。每个case之后输出一个空行。<br /><br />Sample Input<br /><br />11 <br />5 5 5 5 5 5 1 2 3原创 2011-03-16 16:52:00 · 332 阅读 · 0 评论 -
boj 1333 想法十分简单。。不多说了。。复杂的我不会。。这个题给的不太完善感觉
烦人的交通Submit: 433 Accepted:256Time Limit: 1000MS Memory Limit: 1000KDescription奥运会来了,北京的交通实在让人担忧,特别是交错复杂的立交桥 。真是让人眼花缭乱,所以聪明的你,要为交通部规划一种方案来简化这烦人的立交桥。简化方案是,在任意两个地方都能通过立交桥到达的前提下,尽量减少桥的数量。假设每条立交桥连接了两个不同的地方,并且立交桥是无向的。(注意:由于现有的立交桥是在太混乱,两个地方甚至有多条立交桥可到达 ――!) Inp原创 2011-03-17 16:08:00 · 296 阅读 · 0 评论 -
boj 1334 思路混乱 弄了2个下午。。太笨了。。。 思路:先按起始时间排序,起始时间相同的,只保留结束时间最长的,然后判断。
912的卫生Submit: 321 Accepted:62Time Limit: 1000MS Memory Limit: 65536K<br />Description<br />由于912的大牛们太专注于编程,以至于经常忘记打扫卫生,为此xiuge专门任命了一位卫生部长——cloudiris,她准备安排大牛们打扫卫生,而大牛们由于太忙了,每个人都只有一段时间可以打扫,而xiuge规定必须要在1到T时间内都保证有人打扫,所以请你帮助卫生部长,来计算最少需要的人数。<br /><br />Input<原创 2011-03-20 18:47:00 · 739 阅读 · 0 评论 -
boj problem 1330 顺利AC 注意输入或输出数据较多时 scanf printf 比cin cout快非常多~
继续寻找相同Submit: 1095 Accepted:199Time Limit: 2000MS Memory Limit: 65535KDescription有 n 个整数,其中有且仅有一个整数出现了 >= n/2.0 次 (nInput每组数据第一行是 n,然后接下来一行是 n 个整数。Output输出每行格式如A题Sample Input9 5 5 5 5 5 1 2 3 4Sample OutputCase 1: 5Source原创 2011-03-17 19:09:00 · 327 阅读 · 0 评论 -
boj 1329 简单算法 利用栈来计数
寻找相同Submit: 1756 Accepted:421Time Limit: 1000MS Memory Limit: 65535KDescription有一组数,很多很多个数,里面有一个数出现了超过一半次,请你把它找出来。Input先是一个N (NOutput对每个Case,输出一行,这一行只含有一个在之前数列中出现超过一半次的数。每个case之后输出一个空行。Sample Input11 5 5 5 5 5 5 1 2 3 4 6Sample OutputCase 1: 5Source#inc原创 2011-03-17 16:54:00 · 312 阅读 · 0 评论 -
problem 1335 请教的 思路代码如下
突然的任务Submit: 269 Accepted:86Time Limit: 1000MS Memory Limit: 65536K<br />Description<br />一天Wangkun晚上回寝室时,突然接到dalong通知的任务,wangkun以为这个任务不难便欣然答应了,于是开始做这个艰巨的任务。<br />任务是这样的,dalong给了一个for循环,叫wangkun计算出这个循环会做多少次。<br />For( I = a ; I ! = b ; I + = c) ; <br />原创 2011-03-18 18:54:00 · 236 阅读 · 0 评论 -
boj problem 1337 简单题 分奇数偶数
<br />地址http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1337RugsSubmit: 87 Accepted:43Time Limit: 1000MS Memory Limit: 65535K<br />Description<br />Rugs come in various sizes. In fact, we can find a rug with any integer width and length, e原创 2011-03-22 14:29:00 · 342 阅读 · 0 评论 -
boj 1339 简单题 用递归找到最大素数因子即可
<br />地址:http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1339<br />Description<br />To improve the organization of his farm, Farmer John labels each of his N (1 <= N <= 5,000) cows with a distinct serial number in the range 1..20,000. Unfortu原创 2011-03-22 17:52:00 · 460 阅读 · 0 评论 -
boj 1343 汉诺塔 递归问题 谢谢大牛的解答 我需要多联系
<br />地址:http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1343<br /> <br /> Tower of HanoiSubmit: 115 Accepted:31Time Limit: 1000MS Memory Limit: 65535K<br />Description<br />The Tower of Hanoi is a puzzle consisting of three pegs(namead 1,原创 2011-03-24 23:15:00 · 667 阅读 · 0 评论 -
boj 1343汉诺塔 递归问题 多谢大牛的代码和讲解 我需要多联系类似题目
<br />地址:http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1343<br /> Tower of HanoiSubmit: 115 Accepted:31Time Limit: 1000MS Memory Limit: 65535K<br />Description<br />The Tower of Hanoi is a puzzle consisting of three pegs(namead 1,2,3) an原创 2011-03-24 23:18:00 · 346 阅读 · 0 评论 -
qsort函数的比较函数用法
七种qsort排序方法本文中排序都是采用的从小到大排序>一、对int类型数组排序int num[100]; Sample: int cmp ( const void *a , const void *b ) { return *(int *)a - *(int *)b; //强制转换类型} qsort(num,100,size转载 2012-02-28 16:32:33 · 1661 阅读 · 0 评论