Catherine_zhilin

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2019年7月5日

摘要: 提交代码: 1 #include <stdio.h> 2 3 //定义常量 宏定义(宏替换) 4 #define maxn 100010 5 6 int school[maxn]={0}; 7 8 int main(){ 9 10 int n,schID,score; 11 scanf("%d",& 阅读全文
posted @ 2019-07-05 14:47 kkkshiki 阅读(182) 评论(0) 推荐(0)

摘要: 卡拉兹(Callatz)猜想 对任何一个自然数n,如果它是偶数,那么将他砍掉一半;如果它是奇数,那么把(3*n+1)砍掉一半。这样一直反复砍下去,最后一顶在某一步得到n=1。 卡拉兹在1950年的世界数学家大会上公布了这个猜想。 此处非要证明卡拉兹猜想,而是对给定的任何一个不超过1000的正整数n简 阅读全文
posted @ 2019-07-05 14:44 kkkshiki 阅读(202) 评论(0) 推荐(0)

摘要: 黑盒测试 系统会判断每组数据的输出结果是否正确。 单点测试只需要按正常的逻辑执行一遍程序即可。 多点测试: while...EOF型 while...(T--)型 在多点测试中,每次循环都要重置一下变量和数组,否则在下一次数据来临时变量和数组就不是初始状态了。 重置数组一般使用memset函数或者f 阅读全文
posted @ 2019-07-05 14:34 kkkshiki 阅读(230) 评论(0) 推荐(0)

摘要: 时间按复杂度 空间复杂度 编码复杂度 阅读全文
posted @ 2019-07-05 14:18 kkkshiki 阅读(191) 评论(0) 推荐(0)

摘要: 若想要手动提供id和gender初始化参数 或者: 这样可以直接在需要时对结构体变量赋值: 只要参数个数和类型不完全相同可以定义多个构造函数 应用实例:结构体Point 用于存放平面点的坐标x,y 1 #include <stdio.h> 2 3 struct Point{ 4 int x,y; 5 阅读全文
posted @ 2019-07-05 14:16 kkkshiki 阅读(493) 评论(0) 推荐(0)

摘要: 对引用变量的操作就是对原变量的操作 1 #include <stdio.h> 2 3 void change(int&x){ 4 x=1; 5 } 6 int main(){ 7 int x=10; 8 change(x); 9 printf("%d\n",x); 10 return 0; 11 } 阅读全文
posted @ 2019-07-05 13:44 kkkshiki 阅读(131) 评论(0) 推荐(0)

摘要: 1 #include <stdio.h> 2 3 void change (int *p){ 4 *p=233; 5 } 6 7 /*将变量的地址传入函数。在函数中对地址的元素进行改变,原先的数据也会改变*/ 8 int main(){ 9 int a=1; 10 int *p=&a; 11 cha 阅读全文
posted @ 2019-07-05 13:38 kkkshiki 阅读(197) 评论(0) 推荐(0)

摘要: 1 #include <stdio.h> 2 3 /*数组名称也作为数组的首地址使用*/ 4 int main(){ 5 int a[10]={1}; 6 int *p=a; 7 printf("%d\n",*p); 8 return 0; 9 } 1 #include <stdio.h> 2 3 阅读全文
posted @ 2019-07-05 09:10 kkkshiki 阅读(191) 评论(0) 推荐(0)

摘要: 1 #include <stdio.h> 2 3 /*在变量前面加上&就可以表示变量的地址*/ 4 int main(){ 5 int a=1; 6 printf("%d,%d\n",&a,a); 7 return 0; 8 } 指针变量 int* p; double* p; char* p; in 阅读全文
posted @ 2019-07-05 09:09 kkkshiki 阅读(147) 评论(0) 推荐(0)

摘要: 1 #include <stdio.h> 2 3 int max_2(int a,int b){ 4 if(a>b) return a; 5 else return b; 6 } 7 8 /*在max_3中调用max_2比较大小*/ 9 int max_3(int a,int b,int c){ 1 阅读全文
posted @ 2019-07-05 08:42 kkkshiki 阅读(268) 评论(0) 推荐(0)

摘要: strlen()可以得到字符数组中第一个\0前的字符的个数 1 #include <stdio.h> 2 #include <string.h> 3 4 int main(){ 5 char str [10]; 6 gets(str); 7 int len=strlen(str); 8 printf 阅读全文
posted @ 2019-07-05 00:05 kkkshiki 阅读(280) 评论(0) 推荐(0)