随笔分类 -  数据结构与算法

【ACM】找新朋友
摘要://make up a table of prime factors #include #include #define MAX 32769/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main(int argc, char *ar... 阅读全文
posted @ 2014-01-01 21:20 HelloYou 阅读(241) 评论(0) 推荐(0) 编辑
【ACM】Largest prime factor
摘要:/*打表把素数能组合的数先设置成相应的位数*/ /* if n equals two and n is No.1 position of prime factors so four position of prime factors is no.1,as well*/ /* although two can combined six but three also can comb... 阅读全文
posted @ 2013-12-17 21:45 HelloYou 阅读(545) 评论(0) 推荐(0) 编辑
【ACM】How many prime numbers
摘要:http://acm.hdu.edu.cn/game/entry/problem/show.php?chapterid=2&sectionid=1&problemid=2 #include #include #include /* run this program using the console pauser or add your own getch, system("pause... 阅读全文
posted @ 2013-12-10 21:58 HelloYou 阅读(201) 评论(0) 推荐(0) 编辑
【ACM】最小公倍数
摘要:http://acm.hdu.edu.cn/game/entry/problem/show.php?chapterid=2&sectionid=1&problemid=1 #include #include /* run this program using the console pauser or add your own getch, system("pause") or input l... 阅读全文
posted @ 2013-12-10 21:51 HelloYou 阅读(309) 评论(0) 推荐(0) 编辑
【ACM】Crixalis's Equipment
摘要:#include "stdio.h"#include "stdlib.h"/* 贪心算法: Ai->x 表示第i个物品的体积Ai->y 表示第i个物品移动所需要的空间大小前提:所有物品的移动空间都不大于容积V Ai->x + A(i+1)->y 表示先移动第一个物品 再移动第二个物品所需要的瞬时最大空间大小 for example :V = 10 x y 2 10... 阅读全文
posted @ 2013-12-08 20:59 HelloYou 阅读(217) 评论(0) 推荐(0) 编辑
【ACM】Fighting for HDU
摘要:#include #include #define max 100 /* run this program using the console pauser or add your own getch, system("pause") or input loop */void Bubble_sort(int *p,int n){ int i,j,temp; for( i=0 ; ip[j+1]) { temp=p[j]; p[j]=p[j+1]; p... 阅读全文
posted @ 2013-12-06 22:25 HelloYou 阅读(314) 评论(0) 推荐(0) 编辑
【ACM】杭电ACM题一直WA求高手看看代码
摘要:数据测试了好几个都没问题,可以就是WA不让过,检测了2个小时还是没发现有什么问题T_T!!求高手看看代码,小弟在此谢谢各位哦!#include #include #define max 1000/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main(int argc, char *argv[]) { int stu[max]; //学生的ID int stur[max]; //学生的成绩 int ran... 阅读全文
posted @ 2013-12-06 21:55 HelloYou 阅读(2516) 评论(32) 推荐(1) 编辑