![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
striker0
这个作者很懒,什么都没留下…
展开
-
7-1 查找字符串中最长的数字子串 (100 分)
#include<stdio.h>#include<string.h>#define n 100int main(){ int i,j=0,k; char str[n],temp[n]={0},max[n]={0}; gets(str); for(i=0;i<=strlen(str);i++){ if(str[i]>='0'&&str[i]<='9'){ temp[j]=s原创 2021-04-21 13:45:54 · 569 阅读 · 0 评论 -
实验一 基本概念和时间复杂度
C作业第2次单选题函数题编程题单选题2-1 O(mn)下面代码段的时间复杂度是()。(2分)for ( i=0; i<n; i++ )for ( j=0; j<m; j++ )a[i][j]=0;2-2 O(n2)下面代码段的时间复杂度是()。(2分)s=0;for ( i=0; i<n; i++ )for( j=0; j<n; j++ )s+=B[i][j];sum=s;2-3 O(n2)下面代码段的时间复杂度是()。(2分)x=0;原创 2021-03-14 01:14:58 · 4835 阅读 · 6 评论 -
7-1 通讯录排序 (20 分)
#include <stdio.h>int main(){ struct address{ char name[10]; int birth; char phone[17]; }a[10],t; int n; scanf("%d",&n); int i,j; for(i=0;i<n;i++) scanf("%s %d %s",a[i].name,&a[i].birth,a[i].phone); for(i=0;i<n-1;i++){原创 2021-03-12 16:44:09 · 1313 阅读 · 1 评论 -
6-5 计算天数[2] (15 分)
6-5 计算天数[2] (15 分)本题要求实现一个简单函数,计算年year、月month和日day对应的是该年的第几天。其中1、3、5、7、8、10、12月有31天,4、6、9、11月有30天,2月平年有28天,闰年有29天。判断闰年的条件是:能被 4 整除但不能被 100 整除,或者能被 400 整除。函数接口定义:在这里描述函数接口。例如:int day_of_year(int year, int month);其中year、month和day是用户传入的参数。函数返回年year、月mon原创 2021-03-12 15:38:49 · 4200 阅读 · 0 评论 -
6-4 统计个位为8的数(*) (10 分)
请编写函数,求整数数组中个位为 8 的数的个数。函数原型int ArrayEight(const int *array, int size);说明:array 为数组的起始地址,size 为数组元素个数。函数值为数组中个位为8的数的个数。裁判程序#include <stdio.h>#include <stdlib.h>#define arraySize 1024void ArrayInput(int *array, int size);int ArrayEi原创 2021-03-12 15:18:46 · 340 阅读 · 0 评论 -
6-3 统计奇数(*) (10 分)
请编写函数,求整数数组中奇数的个数。函数原型int ArrayOdd(const int *array, int size);说明:array 为数组的起始地址,size 为数组元素个数。函数值为数组中奇数的个数。裁判程序#include <stdio.h>#include <stdlib.h>#define arraySize 1024void ArrayInput(int *array, int size);int ArrayOdd(const int原创 2021-03-12 15:15:48 · 861 阅读 · 0 评论 -
6-2 求数组最大值(*) (10 分)
6-2 求数组最大值(*) (10 分)请编写函数,求整数数组元素的最大值。函数原型int ArrayMax(const int *array, int size);说明:array 为数组的起始地址,size 为数组元素个数。函数值为数组元素的最大值。裁判程序#include <stdio.h>#include <stdlib.h>#define arraySize 1024void ArrayInput(int *array, int size);in原创 2021-03-12 15:05:14 · 2513 阅读 · 0 评论 -
6-1 整数数组-总和(*) (10 分)
懒得区分格式了,所以就一股脑儿全用代码块写好了求数组总和(*)请编写函数,求整数数组元素的总和。函数原型int ArraySum(const int *array, int size);说明:array 为数组的起始地址,size 为数组元素个数。函数值为数组元素的总和。裁判程序#include <stdio.h>#include <stdlib.h>#define arraySize 1024void ArrayInput(int *array, in原创 2021-03-12 14:15:36 · 1303 阅读 · 0 评论