E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
ACM_莫比乌斯反演
acdream 1148 GCD SUM
莫比乌斯反演
ansx,ansy
GCD SUM Time Limit: 8000/4000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) Submit Statistic Next Problem Problem Description 给出N,M 执行如下程序: long long ans = 0,ansx
·
2015-11-03 21:34
SUM
莫比乌斯反演
形式1 已经有函数F(n)=∑ f(d),可以导出 f(n)= ∑ μ(d)F(n/d) d|n &n
·
2015-11-02 15:04
【读书笔记】莫比乌斯函数与
莫比乌斯反演
一、莫比乌斯(Möbius)函数 对于每个正整数n(n ≥ 2),设它的质因数分解式为: 根据这个式子定义n的莫比乌斯函数为: 也就是如果n有平方因子,则为0. 否则是-1的质因数个数次方。 举个简单的例子:6 = 2 × 3,所以; 9 = 3×3, 所以 【命题一】 对于正整数n
·
2015-11-02 15:14
读书笔记
UVa 10214 (
莫比乌斯反演
or 欧拉函数) Trees in a Wood.
题意: 这道题和POJ 3090很相似,求|x|≤a,|y|≤b 中站在原点可见的整点的个数K,所有的整点个数为N(除去原点),求K/N 分析: 坐标轴上有四个可见的点,因为每个象限可见的点数都是一样的,所以我们只要求出第一象限可见的点数然后×4+4,即是K。 可见的点满足gcd(x, y) = 1,于是将问题转化为x∈[1, a], y∈[1, b],求gcd(x, y)
·
2015-11-02 11:44
tree
UVa 1363 (数论 数列求和) Joseph's Problem
- (i+1)*p = k - i*p - p = k mod i - p 则对于某个区间,i∈[l, r],k/i的整数部分p相同,则其余数成等差数列,公差为-p 然后我想到了做
莫比乌斯反演
时候有个分块加速
·
2015-11-02 11:42
uva
HDU 1695 (
莫比乌斯反演
) GCD
题意: 从区间[1, b]和[1, d]中分别选一个x, y,使得gcd(x, y) = k, 求满足条件的xy的对数(不区分xy的顺序) 分析: 虽然之前写过一个
莫比乌斯反演
的总结,可遇到这道题还是不知道怎么应用
·
2015-11-02 11:30
HDU
HDU 4746 (
莫比乌斯反演
) Mophues
本文转自hdu4746(
莫比乌斯反演
) 题意:给出n, m, p,求有多少对a, b满足gcd(a, b)的素因子个数<=p,(其中1<=a<=n, 1<=b<=m
·
2015-11-02 11:30
HDU
poj 3904(
莫比乌斯反演
)
POJ3904 题意:从n个数中选择4个数使他们的GCD=1,求总共有多少种方法SampleInput4 2345 4 2468 7 2345768SampleOutput1 0 34思路:先求出选择四个数所有的情况,C(4,n)=n*(n-1)*(n-2)*(n-3),然后减去GCD为2,GCD为3......;在这过程中我们会把GCD=6减去两次,所以需要加上。刚好满足莫比乌斯函数函数:合数为
Fun_Zero
·
2015-11-01 20:00
数论
莫比乌斯反演
UVa 11526 H(n)
分析: 这个题很像我做
莫比乌斯反演
时的一个分块加速的优化。 注意到n/i的整数部分,有许多重复的数。具体一点,对于某一
·
2015-11-01 14:13
uva
SWJTU 2212 简单的GCD (
莫比乌斯反演
)
简单的GCD Time Limit:1000MS Memory Limit:32768KTotal Submit:12 Accepted:4 Description 问题很简单(洁),有 T 个询问,每次询问 a,b,d ,问有多少对 (x,y) 满足 1 ≤ x ≤ a, 1 ≤ y ≤ b ,且 Gcd(x,y) = d 。 注意这里(x=1, y=2)与(x=2, y
·
2015-11-01 13:42
GC
[
ACM_
模拟] UVA 12504 Updating a Dictionary [字符串处理 字典增加、减少、改变问题]
Updating a Dictionary In this problem, a dictionary is collection of key-value pairs, where keys are lower-case letters, and values are non-negative integers. Given
·
2015-11-01 10:30
字符串处理
[
ACM_
水题] UVA 12502 Three Families [2人干3人的活后分钱,水]
Three Families Three families share a garden. They usually clean the garden together at the end of each week, but last week, family C was on holiday, so family A sp
·
2015-11-01 10:29
ACM
[
ACM_
模拟] UVA 12503 Robot Instructions [指令控制坐标轴上机器人移动 水]
Robot Instructions You have a robot standing on the origin of x axis. The robot will be given some instructions. Your task is to predict its position after executin
·
2015-11-01 10:29
struct
SPOJ-7001 VLATTICE
莫比乌斯反演
定理
后来才知道要用到
莫比乌斯反演
定理: 已知 f(n) = sigma
·
2015-11-01 10:41
poj
【
莫比乌斯反演
】专题总结
莫比乌斯反演
莫比乌斯反演
就是一个能求gcd为多少的个数有几个的东西- -(反正我只知道这么用) f(x)表示gcd为x的倍数的个数 g(x)表示gcd为x的个数
莫比乌斯反演
的基本形式是
·
2015-10-31 17:45
总结
BZOJ3309 : DZY Loves Math
莫比乌斯反演
得 $ans=\sum g[i]\frac{a}{i}\frac{b}{i}$ 其中$g[i]=\sum_{j|i}f[j]\mu(\frac{i}{j})$ 由f和miu的性质可得
·
2015-10-31 16:54
Math
SPOJ VLATTICE(
莫比乌斯反演
)
题意:在一个三维空间中,已知(0,0,0)和(n,n,n),求从原点可以看见多少个点思路:如果要能看见,即两点之间没有点,所以gcd(a,b,c)=1 /*来自kuangbin利用推GCD(a,b)的方法,可以推出GCD(a,b,c)=1的个数等于mu[i]*(n/i)*(n/i)*(n/i)的和然而是从0点开始的,而我们只能从1开始计算,因为少了0周围的所有ans初始+3对于A(0,0,
Fun_Zero
·
2015-10-31 15:00
数论
莫比乌斯反演
Visible Lattice Points GCD问题
莫比乌斯反演
SPOJ Problem Set (classical) 7001. Visible Lattice Points Problem code: VLATTICE Consider a N*N*N lattice. One corner is at (0,0,0) and the opposite one is at (N,N,N). How many lattice po
·
2015-10-31 14:37
visible
nyoj CO-PRIME
莫比乌斯反演
CO-PRIME 时间限制: 1000 ms | 内存限制:65535 KB 难度: 3 描述 This problem is so easy! Can you solve it? You are given a sequence which contains n integers a1
·
2015-10-31 14:36
Prim
UVa 11014 (
莫比乌斯反演
) Make a Crystal
这个题是根据某个二维平面的题改编过来的。 首先把问题转化一下, 就是你站在原点(0, 0, 0)能看到多少格点。 答案分为三个部分: 八个象限里的格点,即 gcd(x, y, z) = 1,且xyz均不为0. 可以先假设xyz都是整数,然后将所求的答案乘8 12个四分之一平面中的点,可以先算(x, y, 0)(x > 0, y > 0)这样的点的个数,然后乘12 坐
·
2015-10-31 11:27
Make
[
ACM_
数据结构] POJ2352 [树状数组稍微变形]
Description Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars tha
·
2015-10-31 11:37
数据结构
[
ACM_
图论] ZOJ 3708 [Density of Power Network 线路密度,a->b=b->a去重]
The vast power system is the most complicated man-made system and the greatest engineering innovation in the 20th century. The following diagram shows a typical 14 bus power system. In
·
2015-10-31 11:36
NetWork
[
ACM_
水题] ZOJ 3712 [Hard to Play 300 100 50 最大最小]
MightyHorse is playing a music game called osu!. After playing for several months, MightyHorse discovered the way of calculating score in osu!: 1. While p
·
2015-10-31 11:36
play
[
ACM_
暴力][
ACM_
几何] ZOJ 1426 Counting Rectangles (水平竖直线段组成的矩形个数,暴力)
Description We are given a figure consisting of only horizontal and vertical line segments. Our goal is to count the number of all different rectangles formed by these segments. As an example, the n
·
2015-10-31 11:36
count
[
ACM_
动态规划] UVA 12511 Virus [最长公共递增子序列 LCIS 动态规划]
Virus We have a log file, which is a sequence of recorded events. Naturally, the timestamps are strictly increasing. However, it is infected by a virus, so random
·
2015-10-31 11:36
动态规划
[
ACM_
动态规划] hdu 1176 免费馅饼 [变形数塔问题]
Problem Description 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老
·
2015-10-31 11:36
动态规划
[
ACM_
模拟] ACM - Draw Something Cheat [n个长12的大写字母串,找出交集,按字母序输出]
Description Have you played Draw Something? It's currently one of the hottest social drawing games on Apple iOS and Android Devices! In this game, you and your friend play in turn. You
·
2015-10-31 11:36
ACM
[
ACM_
数学] LA 3708 Graveyard [墓地雕塑 圈上新加点 找规律]
Description Programming contests became so popular in the year 2397 that the governor of New Earck -- the largest human-inhabited planet of the galaxy -- opened a special Alley of
·
2015-10-31 11:36
ACM
[
ACM_
水题] UVA 11292 Dragon of Loowater [勇士斗恶龙 双数组排序 贪心]
Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. The shores of Rellau Creek in central Loowater had always been a prime breeding ground for g
·
2015-10-31 11:36
water
[
ACM_
模拟][
ACM_
数学] LA 2995 Image Is Everything [由6个视图计算立方体最大体积]
Description Your new company is building a robot that can hold small lightweight objects. The robot will have the intelligence to determine if an object is light enough to hold. It
·
2015-10-31 11:36
image
[
ACM_
图论] The Perfect Stall 完美的牛栏(匈牙利算法、最大二分匹配)
描述 农夫约翰上个星期刚刚建好了他的新牛棚,他使用了最新的挤奶技术。不幸的是,由于工程问题,每个牛栏都不一样。第一个星期,农夫约翰随便地让奶牛们进入牛栏,但是问题很快地显露出来:每头奶牛都只愿意在她们喜欢的那些牛栏中产奶。上个星期,农夫约翰刚刚收集到了奶牛们的爱好的信息(每头奶牛喜欢在哪些牛栏产奶)。一个牛栏只能容纳一头奶牛,当然,一头奶牛只能在一个牛栏中产奶。 给出奶牛们的爱好的信息,计算最
·
2015-10-31 11:35
ACM
[
ACM_
搜索] ZOJ 1103 || POJ 2415 Hike on a Graph (带条件移动3盘子到同一位置的最少步数 广搜)
Description "Hike on a Graph" is a game that is played on a board on which an undirected graph is drawn. The graph is complete and has all loops, i.e. for any two locations there is exactly
·
2015-10-31 11:35
Graph
[
ACM_
图论] Fire Net (ZOJ 1002 带障碍棋盘布炮,互不攻击最大数量)
Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall. A blockhouse is a small cas
·
2015-10-31 11:35
ACM
[
ACM_
图论] Sorting Slides(挑选幻灯片,二分匹配,中等)
Description Professor Clumsey is going to give an important talk this afternoon. Unfortunately, he is not a very tidy person and has put all his transparencies on one big heap. Before giving the talk
·
2015-10-31 11:35
sort
[
ACM_
搜索] Triangles(POJ1471,简单搜索,注意细节)
Description It is always very nice to have little brothers or sisters. You can tease them, lock them in the bathroom or put red hot chili in their sandwiches. But there is also a time when all meanne
·
2015-10-31 11:35
ACM
[
ACM_
动态规划] ZOJ 1425 Crossed Matchings(交叉最大匹配 动态规划)
Description There are two rows of positive integer numbers. We can draw one line segment between any two equal numbers, with values r, if one of them is located in the first row and the other one is
·
2015-10-31 11:35
match
[
ACM_
搜索] POJ 1096 Space Station Shielding (搜索 + 洪泛算法Flood_Fill)
Description Roger Wilco is in charge of the design of a low orbiting space station for the planet Mars. To simplify construction, the station is made up of a series of Airtight Cubical Modules (ACM's
·
2015-10-31 11:35
ACM
[
ACM_
几何] Transmitters (zoj 1041 ,可旋转半圆内的最多点)
Description In a wireless network with multiple transmitters sending on the same frequencies, it is often a requirement that signals don't overlap, or at least that they don't conflict. One way of a
·
2015-10-31 11:35
ACM
[
ACM_
模拟] The Willy Memorial Program (poj 1073 ,联通水管注水模拟)
Description Willy the spider used to live in the chemistry laboratory of Dr. Petro. He used to wander about the lab pipes and sometimes inside empty ones. One night while he was in a pipe, he fell as
·
2015-10-31 11:35
ACM
[
ACM_
其他] Square Ice (poj1099 规律)
Description Square Ice is a two-dimensional arrangement of water molecules H2O, with oxygen at the vertices of a square lattice and one hydrogen atom between each pair of adjacent oxygen atoms. The
·
2015-10-31 11:35
ACM
[
ACM_
图论] Highways (变形说法的最小生成树)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28972#problem/C 题目给出T种情况,每种情况有n个城镇,接下来每一行是第i个城镇到所有城镇的距离(其实就是个可达矩阵)。 求建设一条公路联通所有城镇并且要求最长的一段最小(其实就是最小生成树)!代码如下: #include<
·
2015-10-31 11:34
最小生成树
[
ACM_
数学] Counting Solutions to an Integral Equation (x+2y+2z=n 组合种类)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=27938#problem/E 题目大意:Given, n, count the number of solutions to the equation x+2y+2z=n, where x,y,z,n are non negative inte
·
2015-10-31 11:34
count
[
ACM_
几何] The Deadly Olympic Returns!!! (空间相对运动之最短距离)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28235#problem/B 题目大意: 有两个同时再空间中匀速运动的导弹,告诉一个时间以及各自的初始坐标和该时间时的坐标,求运动过程中的最短距离 解题思路: 求出相对初位置、相对速度,则答案就是原点到射线型轨迹的距离,注意是射线!!!
·
2015-10-31 11:34
return
[
ACM_
几何] F. 3D Triangles (三维三角行相交)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28235#problem/A 题目大意:给出三维空间两个三角形三个顶点,判断二者是否有公共点,三角形顶点、边、内部算三角形的一部分。 解题思路:见模板 //**********************************************
·
2015-10-31 11:34
ACM
[
ACM_
动态规划] 轮廓线动态规划——铺放骨牌(状态压缩1)
Description Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where he had to use his toilet paper to draw on
·
2015-10-31 11:34
动态规划
[
ACM_
图论] 棋盘问题 (棋盘上放棋子的方案数)
不能同行同列,给定形状和大小的棋盘,求摆放k个棋子的可行方案 Input 2表示是2X2的棋盘,1表示k,#表示可放,点不可放(-1 -1 结束) Output 输出摆放的方案数目C Sample Input 2 1 #. .# 4 4 ...# ..#. .#.. #... -1 -1 Sample Output 2 1
·
2015-10-31 11:34
ACM
[
ACM_
其他] 总和不小于S的连续子序列的长度的最小值——尺缩法
Description: 给定长度为n的整数数列,A[0],A[1],A[2]….A[n-1]以及整数S,求出总和不小于S的连续子序列的长度的最小值。如果解不存在,则输出0。 Input: 输入数据有多组,每组数据第一行输入n,S, (10<n<10^5,S<10^8)第二行输入A[0],A[1],A[2]….A[n-1] ( 0<A[i]≤10000)
·
2015-10-31 11:34
ACM
[
ACM_
几何] Metal Cutting(POJ1514)半平面割与全排暴力切割方案
Description In order to build a ship to travel to Eindhoven, The Netherlands, various sheet metal parts have to be cut from rectangular pieces of sheet metal. Each part is a convex polygon with at mo
·
2015-10-31 11:34
meta
[
ACM_
动态规划] Palindrome
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28415#problem/D 题目大意:给一个长为n的字符串,问最少插入几个字符成回文串 解题思路:总长-最长公共(原来的和其倒过来的串)子序列(LCS) 知识详解——LCS:给出两个子序列A,B,求长度最大的公共子序列(如152687和2356984——
·
2015-10-31 11:33
动态规划
[
ACM_
动态规划] Alignment (将军排队)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28415#problem/F 题目大意:有n个士兵排成一列,将军想从中抽出最少人数使队伍中任何士兵都能够看到左边最远处或右边最远处 解题思路:①此题是最长上升子序列的升级版。 &
·
2015-10-31 11:33
动态规划
上一页
17
18
19
20
21
22
23
24
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他