摘要: 水题,注意一定要用__int64#include #include #include #define ll __int64using namespace std;int t;ll n;ll dp[21][3];void init(){ memset(dp,0,sizeof dp); dp[0][1]=1; for(int i=1;i=0;i--){ if(c[i]>=5) ret+=(ll)(c[i]-1)*(dp[i][0]+dp[i][1])+dp[i][1]; else ret+=(ll)c[i]*(dp[i][0]+dp[i][1]); ... 阅读全文
posted @ 2013-10-24 20:38 wonderzy 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 解题思路: dp[i][0]表示未出现吉利数,以2为首的i位数字有多少 dp[i][1]表示未出现吉利数,不以2和4为首的i位数字有多少 dp[i][2]表示出现吉利数的i位数字有多少 注意一下,2前面的数字为6的要排除掉就行 1 #include 2 #include 3 #include 4 using namespace std; 5 int dp[10][3]; 6 void init(){ 7 memset(dp,0,sizeof dp); 8 dp[0][1]=1; 9 dp[1][0]=1,dp[1][1]=8,dp[1][2]=1;10 f... 阅读全文
posted @ 2013-10-24 18:59 wonderzy 阅读(248) 评论(0) 推荐(0) 编辑