Paula and Tai are couple. There are many stories between them. The day Paula left by airplane, Tai send one message to telephone 2200284, then, everything is changing- (The story in "the snow queen"). After a long time, Tai tells Paula, the numb…
Problem Description Recently, Mr. Xie learn the concept of happy number. A happy number is a number contain all digit 7 or only 1 digit other than 7. For example, 777 is a happy number because 777 contail all digit 7, 7177 and 87777 both happy number…
Time limit  1000 ms Memory limit   131072 kB Paula and Tai are couple. There are many stories between them. The day Paula left by airplane, Tai send one message to telephone 2200284, then, everything is changing… (The story in “the snow queen”). Afte…
beautiful number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 801    Accepted Submission(s): 518 Problem Description Let A=∑ni=1ai∗10n−i(1≤ai≤9)(n is the number of A's digits). We call A as “…
转载请声明出处:http://www.cnblogs.com/kevince/p/3887827.html    ——By Kevince 首先声明一下,这里的规律指的是循环,即找到最小循环周期. 这么一说大家心里肯定有数了吧,“不就是next数组性质的应用嘛”,没错,正是如此. 在ACM的比赛中有些时候会遇到一些题目,可以或必须通过找出数据的规律来编写代码,这里我们专门来讨论下 如何运用KMP中next数组的性质 来寻找一个长数组中的最小循环周期. 先来看一道题 ZOJ 3785 What d…
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1216 Assistance Required Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3158    Accepted Submission(s): 1662 Problem Description After the 1997/19…
///找到一个数字序列包含所有n位数(连续)一次且仅一次 ///暴力打表 ///Time:141Ms Memory:2260K #include<iostream> #include<cstring> #include<cstdio> using namespace std; #define MAX 1000010 bool v[MAX]; char num[6][MAX]; int main() { //freopen("in.txt", &quo…
u Calculate e Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 46844    Accepted Submission(s): 21489 Problem Description A simple mathematical formula for e is where n is allowed to go to infini…
题意 给出一个二进制数\(n\),每次操作可以将一个整数\(x\)简化为\(x\)的二进制表示中\(1\)的个数,如果一个数简化为\(1\)所需的最小次数为\(k\),将这个数叫做特殊的数, 问从\(1\)到\(n\)一共有多少个特殊的数,答案对\(1e9+7\)取模. 分析 \(n\)最大为\(2^{1000}\),二进制表示中最多有\(1000\)个\(1\),所以\(n\)以内的数经过一次简化后将变为\(1000\)以内的数,我们可以暴力打表\(1000\)以内的数简化为\(1\)所需的最…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2089 有两种方法: 1.数位DP算法 2.暴力打表——真是个好法子!!! 接下来是注意点: 1.一般这种数组中的一个数减去一个数组的另一个数,sum[i]-sum[j],这时候就要注意是sum[i]-sum[j]还是sum[i]-sum[j-1] 2.打表就不要进行多余的循环和语句 题目代码: #include<iostream> using namespace std; ]={}; int so…