摘要: HDU 1000 A + B Problem I/OHDU 1001 Sum Problem 数学HDU 1002 A + B Problem II 高精度加法HDU 1003 Maxsum 贪心HDU 1004 Let the Balloon Rise 字典树,mapHDU 1005 Number... 阅读全文
posted @ 2014-02-15 17:04 forever97 阅读(809) 评论(0) 推荐(0) 编辑
摘要: #include int main(){ int a,b; while(scanf("%d%d",&a,&b)!=EOF) printf("%d\n",a+b); return 0;} 阅读全文
posted @ 2014-02-15 17:03 forever97 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 题解:做到一种并查集的新题型,在状态压缩的时候传递祖先的信息,每个根结点都是最多移动一次的,所以记录移动次数把自己的加上父亲结点的就是移动总数了。#include #include const int MAXN=10010; int n,q,count[MAXN],f[MAXN],move[MAXN]; int sf(int x){ if(f[x]==x) return x; int t=f[x]; f[x]=sf(f[x]); move[x]+=move[t]; return f[x]; } void Union(int x,in... 阅读全文
posted @ 2014-02-15 15:16 forever97 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 题解:计算出所有可以操作的区间,留下不可操作区间求26的幂次即可,注意直接合并区间端点可能会出现一些问题,所以将右端点加一:#include #include using namespace std; const int mod=1000000007; long long t; int f[10000010]; int sf(int x){return x==f[x]?x:f[x]=sf(f[x]);} int Union(int x,int y){ x=sf(x),y=sf(y); if(x==y)return 0; f[x]=y; ret... 阅读全文
posted @ 2014-02-15 13:21 forever97 阅读(368) 评论(0) 推荐(0) 编辑
摘要: 题解:用并查集将所有的朋友合并,最后记录最大的连通块即可:#include int f[10000010],max,sum[10000010],cnt;int sf(int x){ if(f[x]!=x)f[x]=sf(f[x]); return f[x];}int main(){ int n,x,y; while(scanf("%d",&n)!=EOF){ if(n==0){puts("1");continue;} for(int i=1;iy?x:y; cnt=x>cnt?x:cnt; } ... 阅读全文
posted @ 2014-02-15 12:45 forever97 阅读(119) 评论(0) 推荐(0) 编辑