摘要: 差分数组:将数组相邻两两做差 最后补上原数组的第一个元素得到差分数组后,从左到右累加 可以得到原来的数组 有什么用?如果在原数组的一段连续子数组加上或减去一个值,再次两两作差,并在前面补上原数组的第一个元素,就可以发现只有两个差分数组的下标值发生变化 换句话说,对原数组a的[i,j]区间做加法减法操 阅读全文
posted @ 2025-05-20 08:35 zhouhongyu 阅读(29) 评论(0) 推荐(0)
摘要: 任务1: #include <stdio.h> #define N 80 typedef struct { char name[N]; // 书名 char author[N]; // 作者 } Book; int main() { Book x[] = { {"《雕塑家》", "斯科特.麦克劳德" 阅读全文
posted @ 2023-12-17 10:44 zhouhongyu 阅读(10) 评论(0) 推荐(0)
摘要: 任务1 // P286例8.17 // 对教材上的程序作了微调整,把输出学生信息单独编写成一个函数模块 // 打印不及格学生信息和所有学生信息程分别调用 #include <stdio.h> #include <string.h> #define N 10 // 运行程序输入测试时,可以把这个数组改 阅读全文
posted @ 2023-12-11 16:13 zhouhongyu 阅读(18) 评论(0) 推荐(0)
摘要: 任务四 #include <stdio.h> #define N 80 void replace(char *str, char old_char, char new_char); // 函数声明 int main() { char text[N] = "c programming is diffi 阅读全文
posted @ 2023-11-27 16:46 zhouhongyu 阅读(17) 评论(0) 推荐(0)
摘要: 任务七: #include <stdio.h> #include <string.h> int chongfu(char *a,int n); int main(){ char a[100]; while(gets(a)!='\0'){ if(chongfu(a,strlen(a))){ print 阅读全文
posted @ 2023-11-13 22:17 zhouhongyu 阅读(13) 评论(0) 推荐(0)
摘要: #include <stdio.h> long long func(int n){ if(n==1){ return 2; }else{ return 2*func(n-1); } } int main(){ int n; long long f; while(scanf("%d",&n)!=EOF 阅读全文
posted @ 2023-10-31 23:09 zhouhongyu 阅读(15) 评论(0) 推荐(0)
摘要: 任务1 #include <stdio.h> #include <stdlib.h> #include <time.h> #define N 5 #define N1 374 #define N2 465 int main(){ int number; int i; srand(time(0)); 阅读全文
posted @ 2023-10-16 17:34 zhouhongyu 阅读(15) 评论(0) 推荐(0)
摘要: 实验一 #include <stdio.h> int main(){ printf(" O\n"); printf("<H>\n"); printf("I I\n"); return 0; } #include <stdio.h> int main(){ printf(" O\n"); printf 阅读全文
posted @ 2023-10-01 01:01 zhouhongyu 阅读(28) 评论(0) 推荐(0)