poj 3090 (欧拉函数,找规律)
题目:
给出一个n*n的点阵,求从(0,0)出发斜率不相等的直线有多少条。
限制:
1
思路:
先定义sum[i]
sum[i] = 0, if(i == 1)
sum[i] = sum[i-1] + phi[i], if(i >= 2)
ans = sum[n] * 2 + 3
/*poj 3090
题目:
给出一...
分类:
其他好文 时间:
2015-02-05 11:19:12
阅读次数:
114
Non-abundant sums
Problem 23
A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be ...
分类:
编程语言 时间:
2015-02-05 09:38:22
阅读次数:
169
Lexicographic permutations
Problem 24
A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutation...
分类:
编程语言 时间:
2015-02-05 09:35:31
阅读次数:
155
数据结构基础
UVa 10004 二染色:二部图的判定。(bfs或dfs遍历的过程进行染色,看是否有冲突)UVa 10129 单词:有向图的欧拉道路。UVa 10054 项链:无向图的欧拉回路,首尾相接输出路径。UVa 10596 清晨漫步:无向图的欧拉回路。(对于欧拉道路或回路,在判断连通性等时注意先 if 下要访问的顶点是否出现。)...
分类:
编程语言 时间:
2015-02-04 14:42:37
阅读次数:
350
Coin sums
Problem 31
In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
It ...
分类:
编程语言 时间:
2015-02-04 09:34:29
阅读次数:
194
只看某一个象限 能看到的数 == 一个 象限*4+4
能看到的树既距离原点的距离 gcd(x,y)==1
a 和 b 一大一小 预处理2000以内的phi函数,枚举小的一条边
从1...a 与 a gcd 为 1 的数的个数就是 phi(a)
从 1+a ... 2*a 与 a gcd 为 1 的数的个数 因为 GCD(i,a) = GCD(i+a,a) 所以还是 phi(a)
......
分类:
其他好文 时间:
2015-02-04 00:40:21
阅读次数:
147
欧拉函数/莫比乌斯函数 嗯……跟2910很像的一道题,在上道题的基础上我们很容易就想到先求出gcd(x,y)==1的组,然后再让x*=prime[i],y*=prime[i]这样它们的最大公约数就是prime[i]了…… 当然我们完全没必要这样做……对于每个prime[j],计算在(1,n/pr.....
分类:
其他好文 时间:
2015-02-03 19:12:36
阅读次数:
215
欧拉函数/莫比乌斯函数 Orz iwtwiioi 这个嘛……很明显在同一条线上的两个点一定是满足 x1*k=x2,y1*k=y2,(好吧这个表示方式有点傻逼,懂得就好了)那么这条线上的点只有第一个会被看到,即x,y互质的那一个点(如果gcd(x,y)==k>1那么肯定在它前面还有点(x/k,y/.....
分类:
其他好文 时间:
2015-02-03 18:42:35
阅读次数:
190
题意:有很多路,问能否每条路只走一遍、恰好回到起点?
思路:无向图的欧拉回路的应用。但是是神坑的一道题~
注意:考虑下面的数据
Input:
3 2
0 1
1 0
2 2
1 0
1 0
4 4
0 1
1 0
2 3
3 2
5 6
0 1
1 0
2 3
2 3
0 2
2 0
4 6
1 2
2 1
2 3
2 3...
分类:
其他好文 时间:
2015-02-03 17:12:24
阅读次数:
212
一、同角公式二、三角变换2.1诱导公式:2.2和差公式2.3倍角公式欧拉公式
分类:
其他好文 时间:
2015-02-03 16:36:38
阅读次数:
156