1. Using inline to replace #define when there are paramters 2. Using unsigned int only for bit-operations 3. Using fixed-width type int e.g. uint8_t, ...
分类:
其他好文 时间:
2020-07-27 15:42:42
阅读次数:
67
题意: 给定一个序列ai,问序列中其他数中有多少个数是它的约数 思路: 暴力求法会超时。O(n²) 最优解:先储存每个数的个数,遍历x,每个x的倍数加上x的个数 注:最后每个数的答案要-1(减去本身) Code: #pragma GCC optimize(3) #pragma GCC optimiz ...
给一个序列,我们使用冒泡排序法对它进行排序。请输出在排序过程中会进行多少次交换。 参考大佬:https://www.cnblogs.com/shenshuyang/archive/2012/07/14/2591859.html #define _CRT_SECURE_NO_WARNINGS #inc ...
分类:
编程语言 时间:
2020-07-27 09:39:54
阅读次数:
68
#include<bits/stdc++.h>#define ll long long#define speed_up ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);using namespace std;const ll nl=1e5+5;/ ...
分类:
其他好文 时间:
2020-07-27 09:31:11
阅读次数:
66
//判断输入的数字是否可以构成一棵树 //前一个数是后一个的父亲节点,树的定义:有且仅有一个总根节点,根节点到其他任意节点路径唯一,每个节点只能被其根指向,入度只能为1 #include <stdio.h> #include <string.h> #define maxn 10002 int in[ ...
分类:
其他好文 时间:
2020-07-27 09:18:05
阅读次数:
68
#include<bits/stdc++.h>#define ll long long#define speed_up ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);using namespace std;const ll nl=1e5+5;/ ...
分类:
其他好文 时间:
2020-07-26 23:23:20
阅读次数:
105
跳石头 简单的二分答案,贪心地判断解 #include<bits/stdc++.h> #define fi first #define se second #define pb push_back #define mp make_pair #define SZ(x) ((int)x.size()) ...
分类:
其他好文 时间:
2020-07-26 23:05:34
阅读次数:
73
/etc/login.defs 是设置用户帐号限制的文件。该文件里的配置对root用户无效。优先级低于/etc/shadow里面的配置。 使用vim打开文件 [root@localhost ~]# vim /etc/login.defs # # Please note that the parame ...
分类:
其他好文 时间:
2020-07-26 22:56:50
阅读次数:
65
1 vCPU 简介 CPU 负责计算机程序指令的执行。QEMU-KVM 提供对虚拟机 CPU 的模拟,对于虚拟机来说,其拥有的 CPU 是真实的, 和物理 CPU 没有区别。 实际上,虚拟机在 host 上表现为一个 qemu 进程,而虚拟机的 vCPU (从 host 上看是 vCPU) 则是该进 ...
分类:
其他好文 时间:
2020-07-26 19:37:29
阅读次数:
72
class Event { constructor(){ this.handlers = {}; // 记录所有的事件及处理函数 // { // click: [fn1, fn2], // mouseover: [fn3, fn4], // }; } /** * on 添加事件监听 * @param ...
分类:
其他好文 时间:
2020-07-26 19:05:55
阅读次数:
61