摘要: 转载:https://www.cnblogs.com/zbtrs/p/6106783.html 一.求a~b中不包含49的数的个数. 0 < a、b < 2*10^9 我们要求[a,b]不包含49的数的个数,可以想到利用前缀和来做,具体来说,就是[a,b] = [0,b] - [0,a),(")"是 阅读全文
posted @ 2019-04-09 21:14 Tonyyy 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 给一个只含‘I','D','?'三种字符的字符串,I表示当前数字大于前面的数字,D表示当前的数字小于前面一位的数字,?表示当前位既可以小于又可以大于。 问1~n的排列中有多少个满足该字符串。 Sample Input Sample Output Hint 阅读全文
posted @ 2019-04-06 19:18 Tonyyy 阅读(506) 评论(0) 推荐(0) 编辑
摘要: 有n个高矮不同的士兵,现在要将他们按高,矮依次排列,问有多少种情况。 化简为 n个人,求出可以形成波浪形状的方法数 阅读全文
posted @ 2019-04-06 18:17 Tonyyy 阅读(321) 评论(0) 推荐(1) 编辑
摘要: 两个集合的容斥关系公式:A∪B = A+B - A∩B 三个集合的容斥关系公式:A∪B∪C = A+B+C - A∩B - B∩C - C∩A +A∩B∩C 四个集合的容斥关系公式:A∪B∪C∪D = |A|+|B|+|C|+|D| - |A∩B| - |A∩C| - |A∩D|- |B∩C| - 阅读全文
posted @ 2019-04-03 16:43 Tonyyy 阅读(2640) 评论(0) 推荐(0) 编辑
摘要: Problem Description Orz has two strings of the same length: A and B. Now she wants to transform A into an anagram of B (which means, a rearrangement o 阅读全文
posted @ 2019-04-02 20:06 Tonyyy 阅读(331) 评论(0) 推荐(0) 编辑
摘要: 1.初始化 需要头文件<queue> queue<int>que; 2.成员函数 C++队列Queue类成员函数如下: back()返回最后一个元素 empty()如果队列空则返回真 front()返回第一个元素 pop()删除第一个元素 push()在末尾加入一个元素 size()返回队列中元素的 阅读全文
posted @ 2019-03-29 15:39 Tonyyy 阅读(160) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; int main() { int a[10]; for(int i=1;i<=10;i++) { a[i] = i*5; } for(int i=1;i<=10;i++) cout<<a[i]<<" "; cout<<endl; int it1 ... 阅读全文
posted @ 2019-03-28 21:19 Tonyyy 阅读(128) 评论(0) 推荐(0) 编辑
摘要: string stream1(ll i) { stringstream stream; stream>x; return x; } #include #define ll long long using namespace std; int main() { string t = "123456789"; stringstream ss(t); ... 阅读全文
posted @ 2019-03-24 20:34 Tonyyy 阅读(155) 评论(0) 推荐(0) 编辑
摘要: public class Main{ public static void main(String[] args) { Scanner input = new Scanner(System.in); BigInteger a = input.nextBigInteger(); int count=0; for(Big... 阅读全文
posted @ 2019-03-24 19:45 Tonyyy 阅读(170) 评论(0) 推荐(0) 编辑
摘要: A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer 阅读全文
posted @ 2019-03-17 09:16 Tonyyy 阅读(265) 评论(0) 推荐(0) 编辑