#include <stdio.h>#include <stdlib.h> int main(){ int add[] = { 1,256,12,621,62,3462,6,89999,87}; int g=sizeof(add) / sizeof(add[0]); printf("add数组的长度 ...
分类:
编程语言 时间:
2020-12-15 12:25:11
阅读次数:
4
0. 前言 最近有个需求,就是需要在QT(C++)中移植lua脚本。达到可以动态更新软件功能。lua是一门脚本语言。常用于各类编程语言,作为脚本。特别是游戏行业,据说很多用lua脚本来写业务逻辑。本次分为两种调用,一种是QT调用Lua,这种比较简单。利用Lua源码编译后,直接就可以使用。另外一种是L ...
分类:
其他好文 时间:
2020-12-11 11:52:18
阅读次数:
4
function test($str,$con='utf-8'){ $result = ''; $len = strlen($str); for($i=$len-1;$i>=0;$i--){ $result .= mb_substr($str,$i,1,$con); } return $result ...
分类:
其他好文 时间:
2020-12-09 12:04:18
阅读次数:
6
定义$p(x)\(表示\)\sum_^ bit(x,i)c_i$。一个序列的贡献定义为$\sum p(a_i\ xor \ a_{i+1})$。 给出$[l_i,r_i]$,构造一个序列满足$a_i\in [l_i,r_i]$,求最大贡献。 \(n,k\le 50\) %%%ll倒序开题爆切E。 为 ...
分类:
其他好文 时间:
2020-12-08 12:44:35
阅读次数:
4
什么是内存对齐 以一个例子来说明,以64位系统为例 type test struct { a int32 b byte } func main() { fmt.Println(unsafe.Sizeof(test{})) // 8 } 理论上int32占4个字节,byte占一个字节,test结构体应 ...
分类:
其他好文 时间:
2020-12-02 12:22:43
阅读次数:
4
/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ /** * Return an arr ...
分类:
其他好文 时间:
2020-11-26 14:41:52
阅读次数:
8
noilinux-1.4.1(g4.8.4)下sizeof(long double a)为12,Windows(g4.9.2)和Deepin(g++8.3.0)下都为16 sort默认从小到大排序,默认使用operator<为比较符 priority_queue,默认大根堆,小根堆为priority ...
分类:
其他好文 时间:
2020-11-25 12:25:36
阅读次数:
6
忘了从哪里找的了... char s[10001]; fgets(s,10005,stdin);int n = strlen(s);if (s[n - 1] == '\n' && s[n] == '\0'){ s[n - 1] = '\0';}n = strlen(s); ...
分类:
其他好文 时间:
2020-11-25 12:25:00
阅读次数:
6
https://codeforces.ml/contest/888/problem/G struct TrieNode { int cnt; int num; int nxt[2]; void Init() { cnt = 0; num = 0; memset(nxt, 0, sizeof(nxt) ...
分类:
其他好文 时间:
2020-11-24 12:58:41
阅读次数:
10
Base64代码 base64.c #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <fcntl.h> // bindata待编码数据buffer base64 编码后数据 ...
分类:
其他好文 时间:
2020-11-24 12:13:36
阅读次数:
7