ural 1353. Milliard Vasya's Function
http://acm.timus.ru/problem.aspx?space=1&num=1353
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std; int dp[][];
void inti()
{
memset(dp,,sizeof(dp));
dp[][]=;
for(int i=; i<=; i++)
{
for(int j=; j<=i*; j++)
{
for(int k=; k<=; k++)
{
if(j-k>=)
dp[i][j]+=dp[i-][j-k];
}
}
}
} int main()
{
inti();
int n;
scanf("%d",&n);
if(n==)
{
printf("10\n");
return ;
}
printf("%d\n",dp[][n]);
return ;
}
ural 1353. Milliard Vasya's Function的更多相关文章
- 递推DP URAL 1353 Milliard Vasya's Function
题目传送门 /* 题意:1~1e9的数字里,各个位数数字相加和为s的个数 递推DP:dp[i][j] 表示i位数字,当前数字和为j的个数 状态转移方程:dp[i][j] += dp[i-1][j-k] ...
- ural 1353. Milliard Vasya's Function(背包/递归深搜)
1353. Milliard Vasya's Function Time limit: 1.0 second Memory limit: 64 MB Vasya is the beginning ma ...
- ural 1353. Milliard Vasya's Function(dp)
1353. Milliard Vasya's Function Time limit: 1.0 second Memory limit: 64 MB Vasya is the beginning ma ...
- URAL 1353 Milliard Vasya's Function(DP)
题目链接 题意 : 让你找出1到10^9中和为s的数有多少个. 思路 : 自己没想出来,看的题解,学长的题解报告 题解报告 //URAL 1353 #include <iostream> ...
- Ural 1353 Milliard Vasya's Function(DP)
题目地址:Ural 1353 定义dp[i][j].表示当前位数为i位时,各位数和为j的个数. 对于第i位数来说.总能够看成在前i-1位后面加上一个0~9.所以状态转移方程就非常easy出来了: dp ...
- Codeforces 837E. Vasya's Function
http://codeforces.com/problemset/problem/837/E 题意: f(a, 0) = 0; f(a, b) = 1 + f(a, b - gcd(a, b)) ...
- CodeForces - 837E - Vasya's Function | Educational Codeforces Round 26
/* CodeForces - 837E - Vasya's Function [ 数论 ] | Educational Codeforces Round 26 题意: f(a, 0) = 0; f( ...
- Milliard Vasya's Function-Ural1353动态规划
Time limit: 1.0 second Memory limit: 64 MB Vasya is the beginning mathematician. He decided to make ...
- Codeforces 837E Vasya's Function - 数论
Vasya is studying number theory. He has denoted a function f(a, b) such that: f(a, 0) = 0; f(a, b) = ...
随机推荐
- error in invoking target 'mkldflags ntcontab.o nnfgt.o' of makefile
error in invoking target 'mkldflags ntcontab.o nnfgt.o' of makefile 今天是2013-08-04,在安装oracle11g r2 数据 ...
- Ubuntu 用户及组管理
$是普通管员,#是系统管理员,在Ubuntu下,root用户默认是没有密码的,因此也就无法使用(据说是为了安全).想用root的话,得给root用户设置一个密码:sudo passwd root然后登 ...
- Unity3D——窗体介绍
这是本人第一次的Unity的博客,主要还是依据雨松MOMO的视频来进行的,由于感觉视频比較直观,对于入门比較快,再加上自己有对应的编程基础,如今看书的话效率不高,所以先看几个视频了解一下大体的流程,感 ...
- 初次使用cocoapods注意事项
在仅仅用cocoapods时可能会遇到各种各样的错误和问题 这里中总结下: 1.首先使用cocoapods有非常多优点,在github上非常多优秀的开源项目都用到了它;假设你不会使用它,那么非常多优秀 ...
- Java内部类实现伪方法级多线程
最近碰到一个问题,就是用户在填写相关信息提交后,后台需要将一些文件同步到另外一台服务器,而这个时候,由于用的是spring的框架,导致前端页面需要等待文件同步完成,才能弹出提示信息.相信大家在很多时候 ...
- 打勾显示输入的密码 --EditText与setTransformationMethod
实现目标: 实现原理: 为CheckBox添加一个监听器事件; 实现的源码: package edu.cquptzx.showPassword; import android.app.Activity ...
- HTML基础总结<段落>
HTML 段落 段落是通过 <p> 标签定义的. 实例 <p>This is a paragraph </p><p>This is another pa ...
- 排序算法之奇偶排序 JAVA奇偶排序算法
奇偶排序法的思路是在数组中重复两趟扫描.第一趟扫描选择所有的数据项对,a[j]和a[j+1],j是奇数(j=1, 3, 5……).如果它们的关键字的值次序颠倒,就交换它们.第二趟扫描对所有的偶数数据项 ...
- <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalVal ...
- ajax调用webservice(二) 跨域。
所需工具与项目结构同(一). service.asmx中代码如下: using System; using System.Collections.Generic; using System.Web; ...