2012 Asia Hangzhou Regional Contest】的更多相关文章

Friend Chains http://acm.hdu.edu.cn/showproblem.php?pid=4460 图的最远两点距离,任意选个点bfs,如果有不能到的点直接-1.然后对于所有距离最远的点都bfs一次.最坏n^2 邻接表 #include<cstdio> #include<cstring> #include<iostream> #include<queue> #include<map> #define mt(a,b) mems…
Sum of divisors Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4318    Accepted Submission(s): 1382 Problem Description mmm is learning division, she's so proud of herself that she can figure…
Problem Description In this problem, you are given several strings that contain only digits from '0' to '9', inclusive.An example is shown below.101123The set S of strings is consists of the N strings given in the input file, and all the possible sub…
Problem Description Josh Lyman is a gifted painter. One of his great works is a glass painting. He creates some well-designed lines on one side of a thick and polygonal glass, and renders it by some special dyes. The most fantastic thing is that it c…
Problem Description City C is really a nightmare of all drivers for its traffic jams. To solve the traffic problem, the mayor plans to build a RTQS (Real Time Query System) to monitor all traffic situations. City C is made up of N crossings and M roa…
Browsing History http://acm.hdu.edu.cn/showproblem.php?pid=4464 签到 #include<cstdio> #include<algorithm> using namespace std; ]; int main(){ ; while(~scanf("%d",&n)){ ; while(n--){ scanf("%s",a); ; ;a[i];i++){ sum+=a[i];…
Draw Something http://acm.hdu.edu.cn/showproblem.php?pid=4450 o(n)统计输入每个数的平方和. #include<cstdio> int main(){ int n,x; while(~scanf("%d",&n),n){ ; while(n--){ scanf("%d",&x); ans+=x*x; } printf("%d\n",ans); } ; }…
Lights Against Dudely http://acm.hdu.edu.cn/showproblem.php?pid=4770 15个位置,所以可以暴力枚举那些放,对于放的再暴力枚举哪个转,对于转的,再枚举转哪个方向.选位置放我用了2进制枚举,选出哪个转和枚举4个方向for循环就行.可以加个小剪枝. #include<cstdio> #include<cstring> #include<algorithm> #define mt(a,b) memset(a,b…
意甲冠军:给定的长度可达1000数的顺序,图像password像锁.可以上下滑动,同时会0-9周期. 每个操作.最多三个数字连续操作.现在给出的起始序列和靶序列,获得操作的最小数量,从起始序列与靶序列. 花了一天的时间.我觉得是道非常难的DP.这个阶段非常好划分,对于前面完毕的password锁就不再考虑.问题的关键是这个旋转每次能够的情况非常多. 同一时候也能够发现当I位置上确定移好后,至多影响到后两位.-> dp[i][j][k] 表示当前i位移好后,i+1 为j ,  i+2为k 的次数.…
Description “Be subtle! Be subtle! And use your spies for every kind of business. ”― Sun Tzu“A spy with insufficient ability really sucks”― An anonymous general who lost the warYou, a general, following Sun Tzu’s instruction, make heavy use of spies…