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 ...
随机推荐
- MongoDb gridfs-ngnix文件存储方案 - 图片
http://www.cnblogs.com/wintersun/p/4622205.html 在各类系统应用服务端开发中,我们经常会遇到文件存储的问题. 常见的磁盘文件系统,DBMS传统文件流存储. ...
- ViewPager使用 -------滑动图片
package com.zzw.viewpage; import java.util.ArrayList; import java.util.List; import android.app.Acti ...
- 国际制造执行系统(MES)应用与发展
某些专家认为,当今制造业的生存三要素是信息技术(IT).供应链管理(SCM)和成批制造技术.使用信息技术就是由依赖人工的作业方式转变为作业的快速化.高效化,大量减少人工介入,降低生产经营成本:供应链管 ...
- PropertyGrid 控件使用方法
编写一个对象,后面传递给 PropertyGrid 来显示: using System; using System.Collections.Generic; using System.Linq; us ...
- jQuery 插件开发解析
那么首先我们来简单的看一下最正统的 jQuery 插件定义方式: (function ($) { $.fn.插件名 = function (settings) { //默认参数 var default ...
- Scrapy Learning笔记(四)- Scrapy双向爬取
摘要:介绍了使用Scrapy进行双向爬取(对付分类信息网站)的方法. 所谓的双向爬取是指以下这种情况,我要对某个生活分类信息的网站进行数据爬取,譬如要爬取租房信息栏目,我在该栏目的索引页看到如下页面, ...
- Why java main function is declared as static type?
一个暂且说的过去的解释 The method is static because otherwise there would be ambiguity: which constructor shoul ...
- WPF之旅(二)- XAML
什么是XAML XAML(Extensible Application Markup Lanaguage的简写,发音“zammel”)是用于实例化.NET对象的标记语言.尽管XAML是一种可以用于诸多 ...
- opengl基础学习专题 (三) 多边形绘制的几种样式
题外话 聪明人之所以不会成功,是由于他们缺乏坚韧的毅力. ——艾萨克·牛顿(1643年1月4日—1727年3月31日)英国 也许可以理解为 想更深一步的时候,坚持,努力和聪明缺一不可. 挺直腰杆在此向 ...
- FineUI PK DWZ
一.概述 FineUI(ExtAspNet)是基于 jQuery / ExtJS 的 ASP.NET 控件库. DWZ是基于JQuery的一个客户端框架. 二.比较 三.总结 这两个东西实质都是对控件 ...