1386: 进制转换 输入一个十进制数N,将它转换成R进制数输出。 #include <bits/stdc++.h> using namespace std; string s="0123456789ABCDEF"; int main() { int n,r; while(cin>>n>>r) { ...
分类:
其他好文 时间:
2020-01-31 16:12:40
阅读次数:
72
题目链接: "Click here" Solution: 看到恰好,首先考虑容斥,设$f[i]$表示我们 钦定 $i$种颜色在序列中恰好出现了$S$次有多少种方案 那么现在就有$i+1$个部分,把他看作是可重集的全排列,方案数即 ${n! \over (S!)^i (n Si)}$ ,后面每个都可以 ...
分类:
其他好文 时间:
2020-01-31 14:31:32
阅读次数:
61
We have a collection of rocks, each rock has a positive integer weight. Each turn, we choose the two heaviest rocks and smash them together. Suppose t ...
分类:
其他好文 时间:
2020-01-31 14:13:17
阅读次数:
78
一、原生 Nodejs 获取 post 提交数据 function parsePostData(ctx) { return new Promise((resolve, reject) => { try { let postdata = ""; ctx.req.on('data', (data) => ...
分类:
其他好文 时间:
2020-01-31 14:10:48
阅读次数:
157
167. Two Sum II Input array is sorted(两数之和 II 输入有序数组) 链接 https://leetcode cn.com/problems/two sum ii input array is sorted 题目 给定一个已按照升序排列?的有序数组,找到两个数使 ...
分类:
其他好文 时间:
2020-01-31 14:06:24
阅读次数:
72
快速排序使用分治法(Divide and conquer)策略来把一个序列(list)分为较小和较大的2个子序列,然后递归地排序两个子序列。 步骤为: 挑选基准值:从数列中挑出一个元素,称为"基准"(pivot); 分割:重新排序数列,所有比基准值小的元素摆放在基准前面,所有比基准值大的元素摆在基准 ...
分类:
编程语言 时间:
2020-01-31 14:02:49
阅读次数:
71
In the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue. For now, suppose you are a domin ...
分类:
编程语言 时间:
2020-01-31 12:43:32
阅读次数:
85
注意python的字符和数字转化函数是chr和ord class Solution: def licenseKeyFormatting(self, S: str, K: int) -> str: lst = [] for c in S: if c == '-': continue if c >= ' ...
分类:
其他好文 时间:
2020-01-31 12:22:56
阅读次数:
59
其实暴力也能解,因为就4*4*4*4种 class Solution: def findNext(self, char, nums): i = 0 while i < len(nums): if nums[i] == char: if i != len(nums) - 1: return nums[ ...
分类:
其他好文 时间:
2020-01-31 10:39:27
阅读次数:
56
"Link" 枚举自己的分数$i$,再枚举有多少人$j$的分数是$i$,那么答案就是$\sum\limits_{i=r}^s\sum\limits_{j=1}^p\frac{f(s ij,p j,i){p 1\choose j 1}}j$,其中$f(n,m,l)$是指把$n$个球放进$m$个盒子,每 ...
分类:
其他好文 时间:
2020-01-31 10:30:39
阅读次数:
78