![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ACM
wulinsam
这个作者很懒,什么都没留下…
展开
-
hdu_2064_汉诺塔III
#include using namespace std; long long f(int n) { if(n == 1) return 2; return 3 * f(n-1)+2; } int main(int argc, char *argv[]) { int n; while(cin >> n) cout << f(n) << endl; return 0; }原创 2014-10-12 09:55:16 · 542 阅读 · 0 评论 -
hdu_1033_Edge(模拟)
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1033 #include #include using namespace std; const int MAX = 300; typedef struct { int x,y; }point; int main() { char str[MAX]=" "; while(c原创 2014-12-26 17:07:11 · 580 阅读 · 0 评论 -
poj_2386_lake counting(DFS)
原题链接:http://poj.org/problem?id=2386#include using namespace std; int dx[] = {0,1,1,1,0,-1,-1,-1}, dy[] = {1,1,0,-1,-1,-1,0,1}; char map[101][101]; int r,c; void dfs(int x,int y) { map[x][y] =原创 2014-12-11 09:16:55 · 464 阅读 · 0 评论 -
hdu_1241_Oil Deposits(BFS)
/*算法思路:从字符数组oil的第一元素开始,遍历整个数组, 当遇到'@’时,进入队列push,立即更新此字符为‘* ’,调用bfs(), while循环,结束条件是队列为空,出列pop,在此字符上的8个方向上进行一次遍历, 并入列,且及时更新该字符为‘* ’ … */ #include #include #include using namespace std; int r,c,dx原创 2014-11-15 21:02:04 · 414 阅读 · 0 评论 -
hdu_1708_Fibonacci String
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1708区别格式:1)There is a blank line between output blocks. 2)Please output a blank line after each test case.使用字符串模拟是不行的,要学会想别的方法解决、、、、#include using n原创 2014-12-29 11:19:32 · 650 阅读 · 0 评论 -
hdu_1008_Elevator
http://acm.hdu.edu.cn/showproblem.php?pid=1008原创 2014-12-29 12:05:48 · 448 阅读 · 0 评论 -
hdu_2044_一只小蜜蜂...(递推专题)
http://acm.hdu.edu.cn/showproblem.php?pid=2044/*从1到3 和 从2到3的方法不同*/ #include using namespace std; long long a[51]; //打表 void fac() { a[1] = 1; a[2] = 2; long long a1 = 1; long long a2原创 2014-12-14 16:48:02 · 665 阅读 · 0 评论 -
hdu_5122_K.Bro Sorting
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=5122思路:从最后一个开始,向前比较,维护最小值。#include using namespace std; int a[1000010]; int main(int argc, char *argv[]) { int t; cin >> t; int c1 = 1; while(t--)原创 2014-12-30 21:05:02 · 441 阅读 · 0 评论 -
poj_3669_Meteor Shower(BFS+预处理)
http://poj.org/problem?id=3669 /*思路:BFS+预处理 先预处理会爆炸的区域,BFS,遇到-1则结束*/ #include #include #include using namespace std; int visit[1001][1001]; int dx[5] = {0,0,1,0,-1}; int dy[5] = {0,1,0,-1,0}; type原创 2015-02-08 23:27:50 · 459 阅读 · 0 评论 -
hdu_2028_Lowest Common Multiple Plus
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=2028解题思路:求多个数的最小公倍数,先求第一、二个数的最小公倍数,再与第三个数求它的最小公倍数,重复此过程,第n个数则停止。即可输出结果。 注意两个32位的整数相乘会溢出。。。(不太明白数位溢出现象。。。)#include using namespace std; int lowCom(in原创 2015-02-07 15:00:06 · 617 阅读 · 0 评论 -
hdu_1017_A Mathematical Curiosity(模拟)
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1017#include using namespace std; int main() { int s; cin >> s; while(s--) { int n,m; int cnt = 1; while(1)原创 2014-12-26 14:32:12 · 965 阅读 · 0 评论 -
hdu_1241_Oil Deposits(DFS)
http://acm.hdu.edu.cn/showproblem.php?pid=1241#include using namespace std; int dx[] = {0,1,1,1,0,-1,-1,-1}, dy[] = {1,1,0,-1,-1,-1,0,1}; char map[101][101]; int r,c; void dfs(int x,int y) {原创 2014-12-11 09:30:08 · 470 阅读 · 0 评论 -
hdu_1020_Encoding(模拟)
http://acm.hdu.edu.cn/showproblem.php?pid=1020 #include #include using namespace std; void f(char *a,int len) { int i = 0; int j,cnt = 1; char temp; while(i < len) { te原创 2014-12-25 14:54:25 · 421 阅读 · 0 评论 -
hdu_2072_单词数
#include #include #include using namespace std; int main() { set st; string s = ""; char c; while ((c = cin.get()) != '#') { if(c != ' ') s += c; while (c != '\n') { while ((c = cin.g原创 2014-09-03 14:30:04 · 626 阅读 · 0 评论 -
hdu_1728_逃离迷宫
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1728 #include #include using namespace std; int r,c,k,visit[101][101]; char map[101][101]; int dir_x[4] = {0,1,0,-1},dir_y[4] = {1,0,-1,0}; type原创 2014-11-27 10:39:08 · 484 阅读 · 0 评论 -
hdu_1013_A + B Problem II_(模拟)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1002 解题思路:利用数组进行大数的相加。内置数据类型不能满足整数位数的要求。样例: 1 999 999 1#include #include using namespace std; int num1[1010],num2[1010]; int t[1010]; int result[1010]原创 2014-12-21 23:02:34 · 510 阅读 · 0 评论 -
hdu_1022_Train Problem I_(模拟)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1022 题意:有n辆火车,给出入栈和出栈的顺序,编写程序判段出栈是否正确。 样例:3 123 132 是可以的 #include #include #include using namespace std; int main(int argc, char *argv[]) { in原创 2014-12-21 22:20:14 · 506 阅读 · 0 评论 -
hdu_1002_Let the Balloon Rise (模拟)
#include #include using namespace std; int num1[1010],num2[1010]; int t[1010]; int result[1010]; char str1[1010],str2[1010]; void add(int len1,int len2) { int i,j; for(i = 0;i < len1;i原创 2014-12-21 21:49:19 · 556 阅读 · 0 评论 -
hdu_1013_Digital Roots(模拟)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1013 题意:给一个大数,必须用数组存储,然后求它每个位数之和,如果小于10则输出结果,如果大于10,继续求它和的每位数之和。 例如:1000个9,和为9000,9000>10,再求9000每位数上的和,结果为9,符合题意,则输出。 #include #include using namesp原创 2014-12-21 23:08:38 · 564 阅读 · 0 评论 -
hdu_1031_Design T-Shirt(模拟)
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1031 题意:输入n,m,k,n表示有多少个人,m表示共有多少个设计元素,k表示他要选择的设计元素的个数; n个人都对m中设计的元素做出评价,要求k个设计元素的满意度最大,输出元素的标号(降序输出)。 #include #include using namespace std; typedef原创 2014-12-25 14:11:01 · 617 阅读 · 0 评论 -
hdu_1015_Safecracker(模拟)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1015 够暴力吧! 先排序,然后循环找。。。 #include #include using namespace std; int cmp( const void *a , const void *b ) { return *(char *)a - *(char *)b; } int原创 2014-12-25 14:45:35 · 407 阅读 · 0 评论 -
hdu_1029_Ignatius and the Princess IV(模拟)
http://acm.hdu.edu.cn/showproblem.php?pid=1029 #include #include using namespace std; void f(int *a,int len) { int i = 0; int cnt = 1; while(i < len) { int temp = a[i];原创 2014-12-25 14:35:10 · 596 阅读 · 0 评论 -
poj_3187_Backward Digit Sums
http://poj.org/problem?id=3187 /*总结:头文件#include , next_permutation(num,num+n)生成数组num的全排列, */ #include #include using namespace std; int fun(int *num,int n) { int num1[10];//不能直接使用num操作,涉及内存管理,需要用替原创 2015-02-10 10:37:22 · 553 阅读 · 0 评论