随笔分类 -  基础算法

上一页 1 2 3 4 5 6 7 ··· 10 下一页
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1022 #include<iostream> #include<cstring> #include<stack> using namespace std; int main(){ int n,i,j,k; bool 阅读全文
posted @ 2015-07-08 00:08 wojiaohuangyu 阅读(6) 评论(0) 推荐(0) 编辑
摘要:在大神的基础上进行修改的代码,判断邮箱的正确格式 本代码在dev上边不能运行,在vc6.0上边也不能运行(在网上搜的说是要导入boost库),感觉麻烦就在VS2013上边运行了 #include "stdafx.h" #include<regex> #include<string> #include 阅读全文
posted @ 2015-05-19 22:11 wojiaohuangyu 阅读(4) 评论(0) 推荐(0) 编辑
摘要:测试的是对二叉树的建立 及处理 代码 #include<iostream> #include<string.h> #include<queue> #include<stack> using namespace std; const int max=100000; typedef struct BiN 阅读全文
posted @ 2015-05-05 17:47 wojiaohuangyu 阅读(4) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h> #include<string.h> int main(){ int T; int i,j,k,t,n; while(~scanf("%d",&n),n!=0){ k=n; int flag=0; int temp=0; for(i=1;i<=k;i++){ fl 阅读全文
posted @ 2015-04-28 13:42 wojiaohuangyu 阅读(4) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h> #include<string.h> #include<algorithm> using namespace std; int num_fir[100100]; int num_sec[100100]; int num_thi[100100]; int cmp(i 阅读全文
posted @ 2015-04-24 17:47 wojiaohuangyu 阅读(4) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h> #include<string.h> #include<algorithm> using namespace std; struct node{ int left; int right; }table[300]; int cmp(node x,node y){ r 阅读全文
posted @ 2015-04-19 20:44 wojiaohuangyu 阅读(5) 评论(0) 推荐(0) 编辑
摘要:。。。 #include<stdio.h> #include<string.h> int number[12]; void fun(){ int i,j; number[0]=1; for(i=1;i<12;i++) number[i]=number[i-1]*i; } int main(){ in 阅读全文
posted @ 2015-04-18 17:21 wojiaohuangyu 阅读(2) 评论(0) 推荐(0) 编辑
摘要:水题。。。。 #include<stdio.h> #include<string.h> //__int64 f(__int64 number){ // __int64 t=1; // __int64 i; // for(i=1;i<=number;i++) // t*=i; // return t; 阅读全文
posted @ 2015-04-18 15:57 wojiaohuangyu 阅读(2) 评论(0) 推荐(0) 编辑
摘要:二分法 : #include<stdio.h> #include<string.h> #include<math.h> int main(){ int i,j,k,t; int T; double mod,temp_one,temp_two,last,number; scanf("%d",&T); 阅读全文
posted @ 2015-04-18 10:00 wojiaohuangyu 阅读(3) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h> #include<string.h> int main(){ int m; double n,temp; while(~scanf("%lf%d",&n,&m)){ temp=1/n; printf("%.2lf\n",temp); } return 0; } 阅读全文
posted @ 2015-04-14 19:15 wojiaohuangyu 阅读(2) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h> #include<string.h> int fun(int number){ int i,temp; temp=1; for(i=1;i<=number;i++) temp*=i; return temp; } int main(){ int sum,num,t 阅读全文
posted @ 2015-04-14 18:31 wojiaohuangyu 阅读(4) 评论(0) 推荐(0) 编辑
摘要:虽然比较简单,但是我还是很吃力的才做出来,参考大神的方法。。。 大概思路就是递归,先找出来第一个根,然后根据此根将左子树跟右子树分开,无论是后序还是中序依据根分开,然后再依次递归 #include<stdio.h> #include<string.h> //void deal(char right_ 阅读全文
posted @ 2015-04-14 18:13 wojiaohuangyu 阅读(4) 评论(0) 推荐(0) 编辑
摘要:虽然这都题目简单,但还是花了我俩小时,总是找不到错误。。 本题目用到了栈 #include<stdio.h> #include<string.h> #include<math.h> #include<stdlib.h> #include<stack> using namespace std; cha 阅读全文
posted @ 2015-04-11 09:21 wojiaohuangyu 阅读(4) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h> #include<string.h> #include<math.h> int main(){ int T,n,m,i,j,k,t,flag; scanf("%d",&T); while(T--){ scanf("%d",&m); int a[m]; memset 阅读全文
posted @ 2015-04-07 16:48 wojiaohuangyu 阅读(3) 评论(0) 推荐(0) 编辑
摘要:有时候总感觉好迷茫,我已经大二了,再有两年就要毕业了,我能在大学里边做些什么,就这么过去了,就像大多数人一样???!!!!!! #include<stdio.h> #include<string.h> int main(){ int n; char str1[20],str2[1020]; int 阅读全文
posted @ 2015-03-31 15:18 wojiaohuangyu 阅读(5) 评论(0) 推荐(0) 编辑
摘要:当我首先看到这道题目的时候,我看难度为3,想想一般的算法肯定会超时,但是也想不到其他的方法,于是我就用最笨的存数组的算法试了一下,果然不出我所料。 原谅我没有大神的耐心去一次一次的尝试,参考了大神的算法,果然用着舒服,妈的,看我这出息。。。。。 #include<stdio.h> #include< 阅读全文
posted @ 2015-03-30 22:16 wojiaohuangyu 阅读(3) 评论(0) 推荐(0) 编辑
摘要:本题用到了了搜索和队列,第一次将这两个加起来写,有点吃力。。。。。。 队列相关知识:http://blog.csdn.net/zxy_snow/article/details/6118988 #include<stdio.h> #include<string.h> #include<queue> # 阅读全文
posted @ 2015-03-27 15:48 wojiaohuangyu 阅读(4) 评论(0) 推荐(0) 编辑
摘要:费了我好长时间。。。。。 #include<stdio.h> #include<string.h> __int64 deal1(__int64 x,__int64 y){ __int64 temp; temp=1; while(y){ if(y % 2 == 1) temp = temp * x % 阅读全文
posted @ 2015-03-26 20:52 wojiaohuangyu 阅读(5) 评论(0) 推荐(0) 编辑
摘要:这道题目看了好几个大神的做法,对打表的做法表示灰常佩服。。。。。。 这里是借鉴别人的一种做法 代码: #include<stdio.h> #include<string.h> bool num[9999999]; int prime[1000000]; void deal(){//对数据进行处理 i 阅读全文
posted @ 2015-03-23 21:33 wojiaohuangyu 阅读(4) 评论(0) 推荐(0) 编辑
摘要:好久没有刷题了,今天先做到简单的,练练手。。。。 题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=255 代码:#include<stdio.h> #include<algorithm> using namespace std; int m 阅读全文
posted @ 2015-03-20 14:17 wojiaohuangyu 阅读(4) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 ··· 10 下一页
点击右上角即可分享
微信分享提示