
数据结构与算法
文章平均质量分 65
划过的梦神
Action speak louder than words.
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
python算法(一)
python算法(一) 一、求数x的因子 1 x=100 2 divisors=()#初始化空的元组 3 for i in range(1,x): 4 if x%i==0: 5 divisors=divisors+(i,) 6 print divisors 二、求数x各个数位之和 1 sumdigits=0原创 2017-03-24 10:32:37 · 2387 阅读 · 0 评论 -
Acm练习(十)
Acm练习(十) 九九乘法表 时间限制:1000 ms | 内存限制:65535 KB 难度:1 描述 小时候学过的九九乘法表也许将会扎根于我们一生的记忆,现在让我们重温那些温暖的记忆,请编程输出九九乘法表. 现在要求你输出它的格式与平常的 不同啊! 是那种反过来的三角形啦,具体如下图: 每两个式子之前用一个空格 隔开。。。 输入第一有一个整原创 2017-03-24 10:28:59 · 292 阅读 · 0 评论 -
Acm练习(九)
Acm练习(九) 日期计算 时间限制:3000 ms | 内存限制:65535 KB 难度:1 描述如题,输入一个日期,格式如:2010 10 24 ,判断这一天是这一年中的第几天。 输入第一行输入一个数N(0输出每组输入数据的输出占一行,输出判断出的天数n样例输入 3 2000 4 5 2001 5 4 2010 10 24 样例输出 96 124原创 2017-03-24 10:28:54 · 290 阅读 · 0 评论 -
Acm练习(八)
Acm练习(八) 兰州烧饼 时间限制:1000 ms | 内存限制:65535 KB 难度:1 描述烧饼有两面,要做好一个兰州烧饼,要两面都弄热。当然,一次只能弄一个的话,效率就太低了。有这么一个大平底锅,一次可以同时放入k个兰州烧饼,一分钟能做好一面。而现在有n个兰州烧饼,至少需要多少分钟才能全部做好呢? 输入依次输入n和k,中间以空格分隔,其中1 输出输出全部做好原创 2017-03-24 10:28:51 · 445 阅读 · 0 评论 -
Acm练习(七)
Acm练习(七) 1.素数求和 #includeusing namespace std;int sushu(int x){ int i=2; if(x==1) return 0; for(;i { if(x%i==0) return 0; } return x;}int main(){ int sum=0; int kk; cin>>kk; for(int g原创 2017-03-24 10:28:46 · 392 阅读 · 0 评论 -
Acm练习(六)
Acm练习(六) 1.//1的个数#includeusing namespace std;int jj(int n){ int count=0; for(int l=n;l>0;l=l/2) { if(l%2 !=0 ) { count=count+1; } } return count;}int main(){ int N; cin>>N; for(int原创 2017-03-24 10:28:41 · 458 阅读 · 0 评论 -
acm练习(五)
Acm练习(五) 1.//ASCLL码值排序 /*#includeusing namespace std;void chushi(char a[3]){ for(int i=0;i { cin>>a[i]; }}void paixu(char a[3]){ for(int i1=0;i1 for(int i2=i1;i2 { if(a[i1]>a[i2])原创 2017-03-24 10:28:37 · 866 阅读 · 0 评论 -
acm练习(四)
----------输出格式-------- #includeusing namespace std;int main(){ int a,b,c; cin>>a>>b>>c; cout.width(9); cout.setf(ios::left); cout cout.width(9); cout.setf(原创 2017-03-24 10:28:22 · 329 阅读 · 0 评论 -
acm练习(三)
acm练习(三) //画图 #includeusing namespace std;int main(){ int n; cin>>n; for(int s=0;s { for(int s1=0;s1 { cout } cout }} 已通过 //三个数排序 #includeusing namespace std;int main(){ int a[3]; fo原创 2017-03-24 10:28:18 · 331 阅读 · 0 评论 -
acm练习(二)
acm练习(二) 1.//三个数比较大小 #includeusing namespace std;int main(){ int a[3]; for(int s=0;s { cin>>a[s]; } for(int m=0;m { if(a[m]>a[m+1]) { int temp=a[m]; a[m]=a[m+1]; a[m=1]=temp; } }原创 2017-03-24 10:28:13 · 405 阅读 · 0 评论 -
acm练习(一)
acm 练习(一) //5个数中的最大值,最小值#includeusing namespace std;void sore(int a[5]){ for(int i=0;i for(int j=i;j { if(a[i]>a[j]) { int temp=a[i]; a[i]=a[j]; a[j]=temp; } }}int main(){ int a[5]原创 2017-03-24 10:28:10 · 334 阅读 · 0 评论 -
数据结构实验(四)—— 排序
排序 1.冒泡排序与插入排序、直接选择排序过程 #include using namespace std; typedef int KeyType; typedef int InfoType; typedef struct { KeyType key; InfoType data; }RecType; void InsertSort(RecType R[],int n) { int i,原创 2015-06-15 15:30:10 · 947 阅读 · 0 评论 -
数据结构实验(三)——线性表的查找
线性表的查找 1.线性表的顺序查找与二分法查找 #include using namespace std; #define MAXL 20 typedef int KeyType; typedef int InfoType; typedef struct { KeyType key; InfoType data; }NodeType; typedef NodeType SeqList[原创 2015-06-15 15:22:06 · 1186 阅读 · 0 评论 -
数据实验结构(二)——栈和队列的设计与实现
栈和队列的设计与实现原创 2015-06-15 15:18:11 · 969 阅读 · 0 评论 -
数据结构实验(一)——顺序表和单链表的设计与实现
顺序表和单链表的设计与实现原创 2015-06-15 15:08:34 · 2675 阅读 · 0 评论 -
Acm(练习十)
Acm练习(十) 蛇形填数 时间限制:3000 ms | 内存限制:65535 KB 难度:3 描述在n*n方陈里填入1,2,...,n*n,要求填成蛇形。例如n=4时方陈为:10 11 12 19 16 13 28 15 14 37 6 5 4 输入直接输入方陈的维数,即n的值。(n输出输出结果是蛇形方陈。样例输入 3 样例输出 7 8 1 6 9 2原创 2017-03-24 10:29:03 · 296 阅读 · 0 评论