405. Convert a Number to Hexadecimal Easy Easy Easy Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s com ...
分类:
其他好文 时间:
2019-11-25 14:57:39
阅读次数:
47
要得到最终的和,第一行每个数字出现的(及被加的)次数正好为一个杨辉三角,所以直接枚举第一行就可以了 AC代码: 1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 5 using namespace std; 6 7 ...
分类:
其他好文 时间:
2019-11-25 09:51:14
阅读次数:
67
#include<iostream> #include<map> #include<set> #include<algorithm> using namespace std; const int N = 1e7+10; map<int,bool>vis; set<int>b; int n,a[N], ...
分类:
其他好文 时间:
2019-11-24 13:55:23
阅读次数:
51
问题描述 给定一个整数数组,返回range sum 落在给定区间[lower, upper] (包含lower和upper)的个数。range sum S(i, j) 表示数组中第i 个元素到j 个元素之和。 Note : A naive algorithm of O(n2) is trivial. ...
分类:
其他好文 时间:
2019-11-24 12:00:27
阅读次数:
69
#include <cstring> #include <iostream> #include <algorithm> #include <unordered_set> using namespace std; const int N = 110; int n; int f[N]; int sg(i ...
//只能拿某些特定个数的石子 #include <cstring> #include <iostream> #include <algorithm> #include <unordered_set> using namespace std; const int N = 110, M = 10010; ...
主要摘自https://www.cnblogs.com/skywang12345/p/3706821.html感谢大佬 https://www.cnblogs.com/kubixuesheng/p/4397798.html这位大佬举例很好 一、哈夫曼树(霍夫曼树) 注. 哈夫曼树也称最优二叉树。 叶 ...
分类:
其他好文 时间:
2019-11-23 16:36:23
阅读次数:
100
题目: 单身! 依然单身! 吉哥依然单身! DS级码农吉哥依然单身! 所以,他生平最恨情人节,不管是214还是77,他都讨厌! 吉哥观察了214和77这两个数,发现: 2+1+4=7 7+7=7*2 77=7*11 最终,他发现原来这一切归根到底都是因为和7有关!所以,他现在甚至讨厌一切和7有关的数 ...
分类:
其他好文 时间:
2019-11-23 16:24:58
阅读次数:
55
命令行选项stringstream getline記得特殊處理一下數字n到第一行字符串中間的換行 1 #include <iostream> 2 #include <string> 3 #include <cstring> 4 #include <algorithm> 5 #include <vec ...
分类:
其他好文 时间:
2019-11-22 23:54:51
阅读次数:
111
P2308 添加括号 题解 一看这题 我能AC 看完这题 我要换题 这题第二问其实就是一个链的石子合并,也就是不用处理环 所以一三问怎么处理??? 数组 mid[ i ][ j ] 记录区间 [ l , r ] 的断点 数组 le[ i ] 表示 a[i] 左边有几个左括号 数组 ri[ i ] 表 ...
分类:
其他好文 时间:
2019-11-22 17:48:05
阅读次数:
76