BestCoder19 1001.Alexandra and Prime Numbers(hdu 5108) 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5108题目意思:给出一个数正整数 N,N <= 1e9,现在需要找出一个最少的正整数 M,使得 N/M 是素数。如果找不到就输出0.一开始有想过将所有 <= 1e9 的素数求出来的,不过绝对超...
ACM 杭电HDU 2084 数塔 [解题报告]
数塔Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 36261 Accepted Submission(s): 21659Proble...
【LeetCode】Permutations 解题报告
全排列问题。经常使用的排列生成算法有序数法、字典序法、换位法(Johnson(Johnson-Trotter)、轮转法以及Shift cursor cursor* (Gao & Wang)法。【题目】Given a collection of numbers, return all poss...
【LeetCode】56. Merge Intervals 解题报告(Python & C++ & Java)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/目录题目描述题目大意解题方法日期题目地址:https://leetcode.com/problems/merge-intervals/#/description题目描述Given a col...
LeetCode: Sort Colors 解题报告
Sort ColorsGiven an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the ...
【LeetCode】435. Non-overlapping Intervals 解题报告(Python)
【LeetCode】435. Non-overlapping Intervals 解题报告(Python)作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/题目地址:https://leetcode.com/problems/non-o...
【LeetCode】915. Partition Array into Disjoint Intervals 解题报告(Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/题目地址: https://leetcode.com/problems/partition-array-into-disjoint-intervals/description/题目描述:Gi...
LeetCode 762 Prime Number of Set Bits in Binary Representation 解题报告
题目要求Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a prime number of set bits in their binary representa...
poj 2389.Bull Math 解题报告
题目链接:http://poj.org/problem?id=2389题目意思:就是大整数乘法。题目中说每个整数不超过 40 位,是错的!!!要开大点,这里我开到100.其实大整数乘法还是第一次写 = =.......大整数加法写得比较多。百练也有一条是大整数乘法,链接如下:http://baili...
洛谷 P3373 【模板】线段树 2 解题报告
P3373 【模板】线段树 2题目描述如题,已知一个数列,你需要进行下面三种操作:1.将某区间每一个数乘上\(x\)2.将某区间每一个数加上\(x\)3.求出某区间每一个数的和输入输出格式输入格式:第一行包含三个整数\(N\)、\(M\)、\(P\),分别表示该数列数字的个数、操作的总个数和模数。第...
洛谷 P2261 [CQOI2007]余数求和 解题报告
P2261 [CQOI2007]余数求和题意:求\(G(n,k)=\sum_{i=1}^n k \ mod \ i\)数据范围:\(1 \le n,k \le 10^9\)\(G(n,k)\)\(=\sum_{i=1}^n k-i*\lfloor \frac{k}{i} \rfloor\)\(=n*...
codeforces 557B. Pasha and Tea 解题报告
题目链接:http://codeforces.com/problemset/problem/557/B题目意思:有 2n 个茶杯,规定第 i 个茶杯最多只能装 ai 毫升的水。现在给出 w 毫升的水,需要把这 w 毫升(可以不用光)的水倒入到这 2n 个茶杯中,使得分给 n 个男的每个水杯的水恰好是...
LeetCode: Permutations 解题报告
PermutationsGiven a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1...
[BZOJ2946] [Poi2000]公共串解题报告|后缀数组
给出几个由小写字母构成的单词,求它们最长的公共子串的长度。单词个数<=5,每个单词长度<=2000尽管最近在学的是SAM...但是看到这个题还是忍不住想写SA...(其实是不知道应该怎么用SAM做...对于后缀数组而言,多个字符串的公共子串与两个处理起来并没有什么区别只要在中间加一些没有...
【LeetCode】814. Binary Tree Pruning 解题报告(Python & C++)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/目录题目描述题目大意解题方法后序遍历日期题目地址:https://leetcode.com/problems/binary-tree-pruning/description/题目描述We a...
CF Round #600 (Div 2) 解题报告(A~E)
CF Round #600 (Div 2) 解题报告(A~E)A:Single Push采用差分的思想,让\(b-a=c\),然后观察\(c\)序列是不是一个满足要求的序列#include<bits/stdc++.h>using namespace std;const int maxn ...
LeetCode 349 Intersection of Two Arrays 解题报告
题目要求Given two arrays, write a function to compute their intersection.题目分析及思路给定两个数组,要求得到它们之中共同拥有的元素列表(列表中元素是唯一的)。可以将所给数组转成集合,利用集合的交集的概念,最后将结果转成列表即可。pyt...
uva 489.Hangman Judge 解题报告
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=430 #include <iostream> #includ...
Lintcode: First Bad Version 解题报告
First Bad Versionhttp://lintcode.com/en/problem/first-bad-versionThe code base version is an integer and start from 1 to n. One day, someone commit a ...
Codeforces Round #276 (Div. 2) 解题报告
题目地址:http://codeforces.com/contest/485A题.Factory模拟。判断是否出现循环,如果出现,肯定不可能。代码: #include<cstdio> #include<stdbool.h> using namespace std; int m...