HDU 2451 Simple Addition Expression】的更多相关文章

hdu 2451 Simple Addition Expression Problem Description A luxury yacht with 100 passengers on board is sailing on the sea in the twilight. The yacht is ablaze with lights and there comes out laughers and singing from the hall where an evening party i…
主题链接:http://acm.hdu.edu.cn/showproblem.php?pid=2451 Problem Description A luxury yacht with 100 passengers on board is sailing on the sea in the twilight. The yacht is ablaze with lights and there comes out laughers and singing from the hall where an…
题目大意:有一个关于 简单加法表达式  的定义告诉你,就是  选一个数字i  如果 i+(i+1)+(i+2) 它的和,没有任何一位进位的话,那就是 一个i的简单加法表达式,求小于n的表达式数目. 题解:排列组合分类讨论即可…… #include <cstdio> #include <cmath> #include <cstring> using namespace std; char s[15]; int solve(int i,int p){ if(p==1)ret…
亚洲区域赛的题,简单的数位DP题,注重细节. 任何细节都有可能导致wa,所以没有绝对的水题. 把握好细节,此题便A. #include<stdio.h> __int64 getans(__int64 s) { __int64 ans=0,tmp=1000000000;//这里最大只能取10^9,取10^10就ce了 if(s==0)return 0;//0单独考虑 while(s<tmp) tmp/=10; while(s) { __int64 p=s/tmp,num; if(p>…
题目 最近比赛的题目好多签到题都是找规律的考验智商的题目啊,,,我怎么越来越笨了,,,, 通过列举,可以发现规律: 从左往右按位扫这个数: 当数的长度大于1时: 当首位大于3时,答案就是4*4*4*……*4*3(即pow(4,后面的长度-1)*3): 否则,则是 首位的数字*4*4*4*……*4*3: 当数的长度为1时,并且之前的(即其他的)都没有进位,则直接判断一下ans要加多少个: #include<stdio.h> #include<string.h> #include<…
递推,但是要注意细节.题目的意思,就是求s(x) = i+(i+1)+(i+2),i<n.该表达中计算过程中CA恒为0(包括中间值)的情况.根据所求可推得.1-10: 31-100: 3*41-1000: 3*4*41-10000: 3*4*4*41-10^n: 3*4^(n-1).并且需要注意,一旦发现某一位大于3,则应立即跳出累加的循环.比如,f(133) = 24,f(143) = 24.同时,单独讨论个位的情况.28行的break处理该种情况. #include <cstdio>…
[来源] 2008年哈尔滨区域赛 [题目链接]: http://acm.hdu.edu.cn/showproblem.php?pid=2451 [参考博客]: HDU 2451 Simple Addition Expression [题意]: 题意是要判断前n位数字(不包括n),有多少个数字 i 跟前面两个 i+1 , i+2 ,相加时不进位 . 符合要求的数字就是个位 0 ~ 2 ,其余位 0 ~ 3. 用一个dfs就可以搜出来了. 对于当前位是 x 的话 , 若果 x > 3 , 可以直接得…
Problem Description A luxury yacht with 100 passengers on board is sailing on the sea in the twilight. The yacht is ablaze with lights and there comes out laughers and singing from the hall where an evening party is in full swing. People are singing,…
Simple Addition Expression Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1723    Accepted Submission(s): 675 Problem Description A luxury yacht with 100 passengers on board is sailing on the s…
Problem E Simple Addition Input: Standard Input Output: Standard Output Let’s define a simple recursive function F (n), where Let’s define another function S (p, q), In this problem you have to Calculate S (p, q) on given value of   p and q.   Input…