- 博客(10)
- 资源 (2)
- 收藏
- 关注
原创 poj 3090 Visible Lattice Points (欧拉函数)
Visible Lattice Points Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7768 Accepted: 4760 Description A lattice point (x, y) in the fir...
2017-12-25 20:26:33 177
原创 Codeforces 898D Alarm Clock (贪心好题)
D. Alarm Clocktime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputEvery evening Vitalya sets n alarm clocks to wake up tomorrow. ...
2017-12-19 20:51:26 1014 1
原创 poj2478 Farey Sequence (欧拉函数)
Farey Sequence Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 17495 Accepted: 7014 Description The Farey Sequence Fn for any integer n ...
2017-12-19 16:20:13 159
原创 Codeforces 900C Remove Extra One
C. Remove Extra Onetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutation p of length
2017-12-15 22:29:22 359 2
原创 Codeforces 903D - Almost Difference
题目链接:http://codeforces.com/problemset/problem/903/D思路:对于一个给定的a[x]来说,对于 d(a[1],a[x]) + d(a[2],a[x])+.......+d(a[i].a[x])的结果是 i * a[x] - sum(sum为前x-1项元素的和) + (a[i] - a[x] == 1的所有数的和,即所有等于a[x]+1的数的和)
2017-12-14 22:25:52 457
原创 POJ1284 Primitive Roots (欧拉函数 & 原根)
题目链接:http://poj.org/problem?id=1284题意:给定一个奇素数,求该数有多少原根思路:φ(φ(n)) 表示n的原根的数目 #include <cstdio>#include <cstring>#include <algorithm>using namespace std;int p;int phi(in...
2017-12-13 15:44:59 186
原创 bzoj2705 Longge的问题 (欧拉函数)
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2705思路:假设存在一个数m(1<=m<=n),设gcd(m,n) = k,则可以得到:gcd(m/k,n/k) = 1,所以求与n的最大公约数为k的个数等价于求gcd(m/k,n/k)=1的个数,而gcd(m/k,n/k)=1的个数为phi(n/k); #incl...
2017-12-12 19:32:58 158
原创 CodeForces892B Wrath
题目链接:http://codeforces.com/problemset/problem/892/B题意:对于一排人来说,如果存在i > j && j >= i - a[i],则i可以杀死j,一个人杀死其他人都是同时进行的,问最后会剩下几个人。思路:每当输入一个a[i]时,便判断其与其前面的是否符合上面的条件,符合就下标减一,知道没有元素符合这个条件或者下标变...
2017-12-06 20:33:51 203
原创 CodeForces 768E Game of Stones (Nim博弈)
题目链接:http://codeforces.com/problemset/problem/768/E题意:给定n堆石子,第i堆石子有a[i]个,两个玩家交替从n堆中取石子,不过如果一个玩家在第i堆中取过m个石子,则另一个玩家则不能在第i堆再取m个石子,最后不能取石子的人为输,jon赢则输出YES否则输出NO,jon为后手思路:对于玩家来说,第i堆石子不能拿以前拿过的数量,求出第i堆石子最
2017-12-06 17:41:46 307
原创 codeforces896A Nephren gives a riddle (dfs)
题目链接:http://codeforces.com/problemset/problem/896/A题意:给你一个数字n,代表f(n),然后给定数字k,在f(n)中查找第k个字符,如果k > f(n)的长度,返回‘.’;思路:在f(n)中找到f(n-1)处,递归查找即可#include #define LL long longusing namespace std;char
2017-12-03 16:59:39 542 1
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人