Browsing History http://acm.hdu.edu.cn/showproblem.php?pid=4464

签到

 #include<cstdio>
#include<algorithm>
using namespace std;
char a[];
int main(){
int n,cas=;
while(~scanf("%d",&n)){
int ans=;
while(n--){
scanf("%s",a);
int sum=;
for(int i=;a[i];i++){
sum+=a[i];
}
ans=max(ans,sum);
}
printf("Case %d: %d\n",cas++,ans);
}
return ;
}

Count http://acm.hdu.edu.cn/showproblem.php?pid=4472

dp i 表示个数为i的种类数,它的第二层可以有很多种情况 只要能整除 这是记忆化搜索的写法。

 #include<cstdio>
#include<cstring>
#define mt(a,b) memset(a,b,sizeof(a))
const int M=;
const int mod=1e9+;
int dp[M];
int dfs(int n){
if(~dp[n]) return dp[n];
dp[n]=;
for(int i=;i<=n;i++){
if((n-)%i==){
dp[n]+=dfs((n-)/i);
dp[n]%=mod;
}
}
return dp[n];
}
int main(){
mt(dp,-);
dp[]=;
for(int i=;i<M;i++){
dp[i]=dfs(i);
}
int n,cas=;
while(~scanf("%d",&n)){
printf("Case %d: %d\n",cas++,dp[n]);
}
return ;
}

人人为我写法

 #include<cstdio>
const int M=;
const int mod=1e9+;
int dp[M];
int main(){
dp[]=;
for(int i=;i<M;i++){
dp[i]=;
for(int j=;j<=i;j++){
if((i-)%j==){
dp[i]+=dp[(i-)/j];
dp[i]%=mod;
}
}
}
int n,cas=;
while(~scanf("%d",&n)){
printf("Case %d: %d\n",cas++,dp[n]);
}
return ;
}

我为人人写法

 #include<cstdio>
#include<cstring>
#define mt(a,b) memset(a,b,sizeof(a))
const int M=;
const int mod=1e9+;
int dp[M];
int main(){
mt(dp,);
dp[]=;
for(int i=;i<M;i++){
for(int j=;(j*i+)<M;j++){
dp[j*i+]+=dp[i];
dp[j*i+]%=mod;
}
}
int n,cas=;
while(~scanf("%d",&n)){
printf("Case %d: %d\n",cas++,dp[n]);
}
return ;
}

end

2012 Asia Chengdu Regional Contest的更多相关文章

  1. HDU 4468 Spy(KMP+贪心)(2012 Asia Chengdu Regional Contest)

    Description “Be subtle! Be subtle! And use your spies for every kind of business. ”― Sun Tzu“A spy w ...

  2. HDU 4467 Graph(图论+暴力)(2012 Asia Chengdu Regional Contest)

    Description P. T. Tigris is a student currently studying graph theory. One day, when he was studying ...

  3. HDU-4432-Sum of divisors ( 2012 Asia Tianjin Regional Contest )

    Sum of divisors Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  4. HDU 4436 str2int(后缀自动机)(2012 Asia Tianjin Regional Contest)

    Problem Description In this problem, you are given several strings that contain only digits from '0' ...

  5. 2012 Asia Hangzhou Regional Contest

    Friend Chains http://acm.hdu.edu.cn/showproblem.php?pid=4460 图的最远两点距离,任意选个点bfs,如果有不能到的点直接-1.然后对于所有距离 ...

  6. 2012 Asia JinHua Regional Contest

    Draw Something http://acm.hdu.edu.cn/showproblem.php?pid=4450 o(n)统计输入每个数的平方和. #include<cstdio> ...

  7. 2013 Asia Chengdu Regional Contest

    hdu 4786 Fibonacci Tree http://acm.hdu.edu.cn/showproblem.php?pid=4786 copyright@ts 算法源于ts,用最小生成树可以求 ...

  8. HDU 4433 locker 2012 Asia Tianjin Regional Contest 减少国家DP

    意甲冠军:给定的长度可达1000数的顺序,图像password像锁.可以上下滑动,同时会0-9周期. 每个操作.最多三个数字连续操作.现在给出的起始序列和靶序列,获得操作的最小数量,从起始序列与靶序列 ...

  9. HDU 4115 Eliminate the Conflict(2-SAT)(2011 Asia ChengDu Regional Contest)

    Problem Description Conflicts are everywhere in the world, from the young to the elderly, from famil ...

随机推荐

  1. MongoDb Replica Set中使用的地址

    Unable to connect to a member of the replica set matching the read preference Primary 今天尝试使用MongoDB ...

  2. mariadb一些命令介绍及mariadb架构图和索引

    mariadb> SHOW GLOBAL VARIABLES; 全局变量影响服务器的全局操作 mariadb> SHOW [SESSION] VARIABLES; 客户端变量,只对当前会话 ...

  3. phpcms v9 中get的mysql查询表某字段最大值数据,表某字段不重复数据

    直切正题 1.表tb中字段num最大的数据 {pc:get $sql="select * from tb where num=(select MAX(num) from tb)"} ...

  4. C#高级功能(三)Action、Func,Tuple

    Action和Func泛型委托实际上就是一个.NET Framework预定义的委托,3.5引入的特性.基本涵盖了所有常用的委托,所以一般不用用户重新声明. Action系列泛型委托,是没有返回参数的 ...

  5. Mysql 简单问题汇总(持续更新)

    主从架构相关问题 问题现象:从机连接主机时报错 [ERROR] Slave I/O: error connecting to master 'repl@192.168.0.50:3306' - ret ...

  6. Sublime Text 2编译python时出错

    [Error 2] The system cannot find the file specified [Finished]   解决方法: 1.环境变量path添加: C:\Python32\Too ...

  7. spring事物的七种事物传播属性行为及五种隔离级别

    首先,说说什么事务(Transaction). 事务,就是一组操作数据库的动作集合.事务是现代数据库理论中的核心概念之一.如果一组处理步骤或者全部发生或者一步也不执行,我们称该组处理步骤为一个事务.当 ...

  8. 微信支付开发,再次签名,APP调用

    1.商户服务器生成支付订单,先调用[统一下单API]生成预付单,获取到prepay_id后将参数再次签名传输给APP发起支付. 再次生成签名的时候,按照接口: https://pay.weixin.q ...

  9. JavaScript高级程序设计之基本包装类型

    为便于操作基本类型值,ECMAScript提供了3个特殊的引用类型:Boolean, Number 和 String // 字符串怎么会有方法呢 var str1 = "some text& ...

  10. sharepoint 2010 误删除AD组用户不能访问

    不小心误操作把ad中的组删除了,在sharepoint中是通过组给的权限,在ad中新建了一个同样名的组给了权限组下面的用户还是不能访问. 解决方法: 在sharepoint中把这组从网站集中删除,重新 ...