2012 Asia Chengdu Regional Contest
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的更多相关文章
- 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 ...
- 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 ...
- 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) ...
- HDU 4436 str2int(后缀自动机)(2012 Asia Tianjin Regional Contest)
Problem Description In this problem, you are given several strings that contain only digits from '0' ...
- 2012 Asia Hangzhou Regional Contest
Friend Chains http://acm.hdu.edu.cn/showproblem.php?pid=4460 图的最远两点距离,任意选个点bfs,如果有不能到的点直接-1.然后对于所有距离 ...
- 2012 Asia JinHua Regional Contest
Draw Something http://acm.hdu.edu.cn/showproblem.php?pid=4450 o(n)统计输入每个数的平方和. #include<cstdio> ...
- 2013 Asia Chengdu Regional Contest
hdu 4786 Fibonacci Tree http://acm.hdu.edu.cn/showproblem.php?pid=4786 copyright@ts 算法源于ts,用最小生成树可以求 ...
- HDU 4433 locker 2012 Asia Tianjin Regional Contest 减少国家DP
意甲冠军:给定的长度可达1000数的顺序,图像password像锁.可以上下滑动,同时会0-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 ...
随机推荐
- ThinkPHP常用变量
__ROOT__ : 网站根目录地址 __APP__ : 当前项目(入口文件)地址 __GROUP__:当前分组地址 __URL__ : 当前模块地址 __ACTION__ : 当前操作地址 _ ...
- JQuery ajax返回JSON时的处理方式
最近在使用JQuery的ajax方法时,要求返回的数据为json数据,在处理的过程中遇到下面的几个问题,那就是采用不同的方式来生成json数据的时候,在$.ajax方法中应该是如何来处理的,下面依次来 ...
- Python pass 语句使用示例
Python pass 语句的使用方法示例.Python pass是空语句,pass语句什么也不做,一般作为占位符或者创建占位程序,是为了保持程序结构的完整性,pass语句不会执行任何操作,比如: P ...
- 在PyQt中直接使用ui文件并加载qrc资源文件
1. 用Qt设计师创建一个包含qrc资源文件的ui文件 2.打开cmd使用以下命令把qrc资源文件转换成十六进制的py文件 pyrcc4 -o C:\res.py C:\res.qrc pyrcc4 ...
- Android计时器TimerTask,Timer,Handler
Android计时器TimerTask,Timer,若要在TimerTask中更新主线程UI,鉴于Android编程模型不允许在非主线程中更新主线程UI,因此需要结合Android的Handler实现 ...
- C# 基础 计算平均值的方法
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- python中split与join
1.split个人最喜欢的就是它能使输入的一连串数字变为list. str=raw_input("some ") str2=str.split(" ") str ...
- python 上下文管理器
作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! 上下文管理器(context manager)是Python2.5开始支持的一种语 ...
- static关键字的作用
static可以用来定义静态成员变量.静态函数.静态代码块. 静态成员变量的语法特点 定义方法:在成员变量前面加上static class Person{ static int i; //静态成员变量 ...
- button与submit
原文来自: http://blog.sina.com.cn/s/blog_693d183d0100uolj.html submit是button的一个特例,也是button的一种,它把提交这个动作自动 ...