链接

题意求能够整除和包含13的数字。

这个比较简单,保留余数及1,然后标记前面是否出现过13就行。

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#include<vector>
#include<cmath>
#include<queue>
#include<set>
using namespace std;
#define N 100000
#define LL long long
#define INF 0xfffffff
const double eps = 1e-;
const double pi = acos(-1.0);
const double inf = ~0u>>;
LL n,dp[][][][];
int d[];
LL dfs(int i,bool e,int r,bool o,bool p)
{
if(i==-)
{
return r==&&p;
}
if(!e&&dp[i][r][o][p]!=-)
return dp[i][r][o][p];
int j;
int mk = e?d[i]:;
LL ans = ;
for(j = ; j <= mk ; j++)
{
if(p)
ans+=dfs(i-,e&&j==mk,(r*+j)%,,);
else
{
if(o&&j==)
ans+=dfs(i-,e&&j==mk,(r*+j)%,,);
else if(j==)
ans+=dfs(i-,e&&j==mk,(r*+j)%,,);
else
ans+=dfs(i-,e&&j==mk,(r*+j)%,,);
}
}
return e?ans:dp[i][r][o][p]=ans;
}
LL cal(LL x)
{
int g=;
while(x)
{
d[g++] = x%;
x/=;
}
return dfs(g-,,,,);
}
int main()
{
memset(dp,-,sizeof(dp));
while(cin>>n)
{
cout<<cal(n)<<endl;
}
return ;
}

hdu3652 B-number的更多相关文章

  1. JavaScript Math和Number对象

    目录 1. Math 对象:数学对象,提供对数据的数学计算.如:获取绝对值.向上取整等.无构造函数,无法被初始化,只提供静态属性和方法. 2. Number 对象 :Js中提供数字的对象.包含整数.浮 ...

  2. Harmonic Number(调和级数+欧拉常数)

    题意:求f(n)=1/1+1/2+1/3+1/4-1/n   (1 ≤ n ≤ 108).,精确到10-8    (原题在文末) 知识点:      调和级数(即f(n))至今没有一个完全正确的公式, ...

  3. Java 特定规则排序-LeetCode 179 Largest Number

    Given a list of non negative integers, arrange them such that they form the largest number. For exam ...

  4. Eclipse "Unable to install breakpoint due to missing line number attributes..."

    Eclipse 无法找到 该 断点,原因是编译时,字节码改变了,导致eclipse无法读取对应的行了 1.ANT编译的class Eclipse不认,因为eclipse也会编译class.怎么让它们统 ...

  5. 移除HTML5 input在type="number"时的上下小箭头

    /*移除HTML5 input在type="number"时的上下小箭头*/ input::-webkit-outer-spin-button, input::-webkit-in ...

  6. iOS---The maximum number of apps for free development profiles has been reached.

    真机调试免费App ID出现的问题The maximum number of apps for free development profiles has been reached.免费应用程序调试最 ...

  7. 有理数的稠密性(The rational points are dense on the number axis.)

    每一个实数都能用有理数去逼近到任意精确的程度,这就是有理数的稠密性.The rational points are dense on the number axis.

  8. [LeetCode] Minimum Number of Arrows to Burst Balloons 最少数量的箭引爆气球

    There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided ...

  9. [LeetCode] Number of Boomerangs 回旋镖的数量

    Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of po ...

  10. [LeetCode] Number of Segments in a String 字符串中的分段数量

    Count the number of segments in a string, where a segment is defined to be a contiguous sequence of ...

随机推荐

  1. 【java基础学习】GUI

    GUI 容器 布局管理器 组件 菜单 事件处理机制

  2. Unit04 - 继承的意义(下) 、 访问控制 、 static和final

    Unit04  -  继承的意义(下) . 访问控制 . static和final 1.方法的重写(Override):重新写.覆盖  1)发生在父子类中,方法名称相同,参数列表相同,方法体不同  2 ...

  3. vi基本命令

    http://www.cnblogs.com/younggun/p/3190820.html 要记得经常练习

  4. 移动端html页面布局

    记录一下: ---------- 如果设计稿尺寸为 : 96px: 1. rem html{ font-size:62.5%; } 的情况下 : 4.8rem: 2. rem html{ font-s ...

  5. OpenWrt——神奇的路由系统

    鉴于最近大家对这个系统比较感兴趣而且疑问很多所以本渣就整理下我对这个系统的理解和最实用的802.1x认证的理解.还望大家多多互相交流. 如果您时间紧张直接看最后的步骤,时间充裕的请仔细阅读,理解. O ...

  6. RCNN 和SPPnet的对比

    一.RCNN: 1.首先通过选择性搜索,对待检测的图片进行搜索出2000个候选窗口. 2.把这2k个候选窗口的图片都缩放到227*227,然后分别输入CNN中,每个候选窗台提取出一个特征向量,也就是说 ...

  7. 几个精彩的DMV

    --统计表的增删改次数,反映表的使用程度 SELECT DB_NAME([database_id]) AS [Database] ,iops.[object_id] AS [ObjectID] ,QU ...

  8. PHP中fopen,file_get_contents,curl函数的区别

    PHP中fopen,file_get_contents,curl函数的区别 1.fopen/file_get_contents每次请求都做DNS查询,并不对DNS的信息进行缓存,而curl会对DNS的 ...

  9. MS CRM商机产品等Mapping

    商机明细:报价明细  SELECT  EntityMapId  FROM    EntityMapBase  WHERE   TargetEntityName='quotedetail' AND So ...

  10. PHP计算时间差,并返回什么时间之前发表的内容

    <?php header("Content-type: text/html; charset=utf-8"); function time2Units ($time){ $y ...