C 标准库源码解析:内存拷贝与字符串拷贝

C 标准库中对内存拷贝的操作位于头文件 <string.h>,其中涉及到内存拷贝的函数有:memcpy:内存拷贝,存在内存重叠的风险,源地址空间与目的地址空间的数据安全皆无法保障memmove:内存拷贝,可以保证目的地址空间数据的安全(不越界的情况下),但仍可能破坏源地址空间的数据mempcpy:内存拷贝,返回目的地址空间拷贝末尾后一个地址memccpy:内存拷贝,遇到指定字节时停止,

- 阅读全文 -

CodeCraft 2019 城市交通动态系统最优(DSO)配流问题

【CodeCraft 2019 华为软件精英挑战赛】城市交通动态系统最优配流问题问题简述问题定义在模拟的道路图上为每一辆车规划行驶路线,系统会自动根据规划路线运行。在路线合法的前提下,最终所有车辆按照规划的路线到达目的地。系统调度时间短者胜出。系统调度时间指,从系统调度开始时间,至所有车辆全部到达目的地的时间,两者之差作为系统调度时间。输入与输出道路格式:(道路id, 道路长度, 最高限速, 车道

- 阅读全文 -

围观 IOCCC 上的鬼畜 C 代码

故事是这样的,看到一个知乎专栏名为一段鬼畜的代码的分析文章,超想要感受一下,所以顺着作者的思路来梳理一遍。第一段代码:输出当前时间根据原作者的描述,这段代码来自国际 C 语言混乱代码大赛,即 IOCCC,找了一番却并没有找到,以下是源代码。main(_) { _ ^ 448 && main(-~_); putchar(--_ % 64 ? 32 | -~7[__TIME

- 阅读全文 -

[LeetCode] [0002] Add Two Numbers

描述You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return

- 阅读全文 -

[LeetCode] [0001] Two Sum

描述Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same

- 阅读全文 -