输入 随机序列长度,返回 随机序列 int * randpermC(int N) { int *arr = (int*)malloc(N * sizeof(int)); int *arr2 = (int*)malloc(N * sizeof(int)); int count = 0; memset( ...
分类:
编程语言 时间:
2020-06-26 10:30:24
阅读次数:
91
#include <stdio.h> #include <stdlib.h> #define LEN sizeof(struct node) typedef struct node{ int data; struct node *next; }List; List *selectsort(List ...
分类:
其他好文 时间:
2020-06-25 10:12:54
阅读次数:
53
比赛的时候wa吐了 #include<map> #include<queue> #include<time.h> #include<limits.h> #include<cmath> #include<ostream> #include<iterator> #include<set> #includ ...
分类:
其他好文 时间:
2020-06-24 23:43:49
阅读次数:
64
与 x&y 或 x|y 非!x 异或 x^y 补码 ~x+1是x的补码 memset(a,0x3f,sizeof(a)) 无穷大 左移 在二进制表示下把数字同时向左移动,低位以0填充,高位越界后舍弃 1<<n=2^n n<<1=2n 算数右移 在二进制补码表示下把数字同时向右移动,高位以符号位填充, ...
分类:
其他好文 时间:
2020-06-24 21:50:58
阅读次数:
54
完整阅读C++ Primer Plus 系统重新学习C++语言部分,记录重要但易被忽略的,关键但易被遗忘的。 使用类 1、不能重载的运算符 1 sizeof sizeof运算符 2 . 成员运算符 3 .* 成员指针运算符 4 :: 作用域解析运算符 5 ?: 条件运算符 6 typeid 一个RT ...
分类:
编程语言 时间:
2020-06-23 21:02:45
阅读次数:
69
原题链接 KMP模板:AC,858ms,13112KB内存 消耗太大了 #include<bits/stdc++.h> using namespace std; using namespace std; #define ms(x, n) memset(x,n,sizeof(x)); typedef ...
分类:
其他好文 时间:
2020-06-23 20:53:37
阅读次数:
66
题目描述 如何把一个正整数N(N长度<20)划分为M(M>=1)个部分,使这M个部分的乘积最大。N、M从键盘输入,输出最大值及一种划分方式。 输入格式 第一行一个正整数T(T<=10000),表示有T组数据。 接下来T行每行两个正整数N,M。 输出格式 对于每组数据 第一行输出最大值。 第二行输出划 ...
分类:
其他好文 时间:
2020-06-23 17:17:25
阅读次数:
67
1、使用gets() char *arr; arr = malloc(50 * sizeof(char)); gets(arr); 2、使用scanf() scanf("%[^\n]", arr); //遇到‘\n’结束读取 3、使用getchar() int k = 0; while((arr[k ...
分类:
编程语言 时间:
2020-06-23 15:10:11
阅读次数:
63
L关键字 关键字“L”,则是不管编码环境是什么,都是将其后面的字符串以Unicode方式保存。 即每个字符占用两个字节! 例: cout << sizeof("wang") << endl; 结果为5 //包含字符串结束符'\0' cout << sizeof(L"wang") << endl; 结 ...
分类:
其他好文 时间:
2020-06-23 13:10:56
阅读次数:
52
建一个正向图和反向图,(都存到一个地方,反向图的节点加 n 就好了),跑两边 Dijskra #include <bits/stdc++.h> using namespace std; const int N = 1e3 + 10,M = 1e5 + 10,INF = 0x3f3f3f3f; typ ...
分类:
其他好文 时间:
2020-06-21 19:59:55
阅读次数:
42