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. ElasticSearch 模板文件配置

    首先是推荐一下参考资料 中文资料:http://kibana.logstash.es/content/elasticsearch/index.html 官方文档:https://www.elastic ...

  2. mysql 导入导出数据库、数据表

    Linux下 均在控制台下操作. 导入数据库: 前提:数据库和数据表要存在(已经被创建) (1)将数据表 test_user.sql 导入到test 数据库的test_user 表中 [root@te ...

  3. 浅谈DEs,AES

    1. AES加密,相对比较简单,之前已经配置好工具类. package com.bbguoxue.poetry.util; import java.security.SecureRandom; imp ...

  4. 十天学会单片机Day5 IIC总线AT2402芯片(EEPROM)应用

    1.采用串行总线技术可以使系统的硬件设计大大简化.系统的体积减小.可靠性提高.同时,系统的更改和扩充极为容易. 常用的串行扩展总线有: IIC (Inter IC BUS)总线.单总线(1-WIRE ...

  5. openstack的第二天

    今天,在公司测试了还是网络有问题. 但是用了rdo还是成功了~明天就再试试怎么开放端口进来.

  6. Android 使用Fragment,ViewPagerIndicator 制作csdn app主要框架

    转载  转载请注明出处:http://blog.csdn.net/lmj623565791/article/details/23513993 本来准备下载个CSDN的客户端放手机上,没事可以浏览浏览资 ...

  7. 浅谈objective—C管理内存

    这段时间被导师催着论文,调试各种BUg,也是醉了,发现很大程度上,内存出错,栈溢出,各种悲剧.那么今天就和大家一起对OC的内存管理来个探微吧.Objective-C使用一个保留计数记录了我们所创建的所 ...

  8. oracle 查询谁在用undo

    SELECT TO_CHAR(s.sid)||','||TO_CHAR(s.serial#) sid_serial,NVL(s.username, 'None') orauser,s.program, ...

  9. SQL 集合(笔记)

    ——SQL是关于集合的 oracle是关系型数据,其中的数据表都是有一定规律的数据的一个个集合,所以在使用SQL时,如果能按照集合的思路来进行时会节省很多效率,也鞥让语句更加的清晰明了. 1.四个集合 ...

  10. SystemServer相关

    SystemServer分析 由Zygote通过Zygote.forkSystemServer函数fork出来的.此函数是一个JNI函数,实现在dalvik_system_Zygote.c中. 1.S ...