POJ 2773 Happy 2006 (分解质因数+容斥+二分 或 欧几里德算法应用)...
分类:
移动开发 时间:
2015-08-18 22:43:18
阅读次数:
161
Happy NumberWrite an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any posi...
分类:
移动开发 时间:
2015-08-17 16:51:59
阅读次数:
113
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3703
Happy Programming Contest
Time Limit: 2 Seconds
Memory Limit: 65536 KB
In Zhejiang University Programming Contes...
分类:
移动开发 时间:
2015-08-17 12:06:31
阅读次数:
126
Well, no matter whether the number is happy or not, its sum-of-squared-digits sequance has a cycle. Well, do you still remember the algorithm for dete...
分类:
移动开发 时间:
2015-08-17 00:51:01
阅读次数:
207
一、前言今天又到周末了,感觉时间过的很快呀.这周媳妇生气了,所以就不能和她happy了,那只能写blog了。那么今天就来看看应用的换肤原理解析。在之前的一篇博客中我说道了Android中的插件开发篇的基础:类加载器的相关知识。没看过的同学可以转战:http://blog.csdn.net/jiangwei0910410003/article/details/41384667二、原理介绍现在市场上有...
分类:
移动开发 时间:
2015-08-15 13:32:26
阅读次数:
195
Happy Great BG
Time Limit: 2 Seconds Memory Limit: 65536 KB
The summer training of ZJU ICPC in July is about to end. To celebrate this great and happy day, the coaches of ZJU ICPC Team Navi...
分类:
移动开发 时间:
2015-08-15 06:46:47
阅读次数:
129
题目链接:点击打开链接
题目描述:给出n个数,求从这n个数中任意取出一些数(至少取一个)相互异或之后大于m的方案数?
解题思路:分析由于n
采用动态规划的思想dp[i&1][j]=d[(i-1)&1][j]+d[(i-1)&1][j^a[i]];由于40*10^6太大,所以此处我们采用滚动数组
代码:
#include
#include
using namespace std;
co...
分类:
移动开发 时间:
2015-08-14 21:36:54
阅读次数:
610
题目大意:
给你两个整数N和K,找到第k个与N互素的数(互素的数从小到大排列),其中
(1 <= m <= 1000000,1 <= K <= 100000000 )。
解题思路:
K很大,直接从小到大枚举找出不现实,只能二分答案。二分枚举[1,INF]范围内所有的数x,
找到1~x范围内与N互素的数个数,如果等于K,则就是结果。
然后考虑1~x范围内与N互素的数个数 = x - 1~x范围内与N不互素的数个数
1~x范围内与N不互素的数个数用简单的容斥定理来求即可。...
分类:
移动开发 时间:
2015-08-12 19:27:21
阅读次数:
136
Yangyang loves AC题意: 给出Yangyang N天中每天达到happy 的最大值,他会从M个ACMer中得到happy值;
求他能最多达到happy的天数。
分析: 如果直接贪心显然有问题,所以我们需要换个姿势。
二分答案+贪心:
二分得到最多happy 天数,然后贪心,每次从M个ACMer中选最大的happy值,放到容量最大的盒子里,用优先队列每次维护最大容量的盒子。
算...
分类:
其他好文 时间:
2015-08-09 12:40:51
阅读次数:
158
static List nums = new List(); public static bool IsHappy(int n) { int newint = 0; while (n != 0) { ...
分类:
移动开发 时间:
2015-08-07 19:26:45
阅读次数:
899