百度搜索 网站介绍,app开发网站建设,成都网络推广网站,做哪种类型的网站赚钱呢话说昨天比赛终于拿到一个不错的名次#xff0c;rank77#xff0c;对于我们这种ACM弱菜的学校来说已经很好了#xff0c;可惜我1003用了俩floyd超时#xff0c;如果我最近稍微搞搞图论的话#xff0c;用个bellman#xff0c;或者SPFA#xff0c;绝对超不了了就。。。哎。… 话说昨天比赛终于拿到一个不错的名次rank77对于我们这种ACM弱菜的学校来说已经很好了可惜我1003用了俩floyd超时如果我最近稍微搞搞图论的话用个bellman或者SPFA绝对超不了了就。。。哎。。他们的1002貌似也差点出来。。。还有1004被坑人的wa了两次。。。。 理工大的孩子们看到之后一定好好整理下不管是这场比赛还是前几场比完之后整理再做这些题比较重要。这次比赛的题都不是出不来的大家加油了。。。 第一题小Q系列故事——最佳裁判 链接http://acm.hdu.edu.cn/showproblem.php?pid4520 题解水题啊。。懒得看。。贴大牛毕鲁阳的代码 #includecstdio
#includecstring
#includecstdlib
#includealgorithm
#includecmath
using namespace std;struct cp
{int num;double p;
} P[22];
int cmp(cp a, cp b)
{return a.p b.p ? 1 : 0;
}
int main()
{int n;double sum 0 ;double ave;int ans;double m;while(scanf(%d,n),n){sum 0;m 999999999;for(int i 0; i n; i){scanf(%lf,P[i].p);P[i].num i1;}sort(P, Pn,cmp);for(int i 1; i n-1; i){sum P[i].p;}ave sum / (n-2);for(int i 0; i n; i){if(abs(P[i].p-ave)m){m abs(P[i].p-ave);ans P[i].num;}}printf(%d\n,ans);}return 0;
} 第二题小明系列问题——小明序列 链接http://acm.hdu.edu.cn/showproblem.php?pid4521 题解 第三题湫湫系列故事——过年回家 链接http://acm.hdu.edu.cn/showproblem.php?pid4522 题解 第四题威威猫系列故事——过生日 链接http://acm.hdu.edu.cn/showproblem.php?pid4523 题解两个地方要注意第一就是我一开始没看到数据量wa了一次。。。10^100 我还用int。。真惊了。。当时只图快了。。结果这下就是20分钟。。哎。。。第二点要注意就是。。杭电相当坑人的M。。他的范围是 M0 的这就意味着当M为1或者2的时候。。。n和p无论是多少都分割不出来1边形和2边形。。。。又WA一次。。。哎。。欲速则不达啊一共罚了40分钟。。。 import java.math.BigInteger;
import java.util.Scanner;public class main {public static void main(String[] args) {BigInteger n, m, p;Scanner cin new Scanner(System.in);while (cin.hasNextBigInteger()){n cin.nextBigInteger();m cin.nextBigInteger();p cin.nextBigInteger();BigInteger tmp1 n.add(p);BigInteger tmp2 BigInteger.valueOf(3);if (tmp1.compareTo(m) 0 || m.compareTo(tmp2) 0)System.out.println(NO);elseSystem.out.println(YES);}}
}第五题郑厂长系列故事——逃离迷宫 链接http://acm.hdu.edu.cn/showproblem.php?pid4524 题解一开始没看懂题意好郁闷我理解能力的确有点问题题目的意思右边倒数第一个格子和倒数第二个格子必须同时消失否则郑厂长就无法进行操作。。。就是这里有点坑。。其他都没什么难的。。 #include iostream
using namespace std;
int main()
{int t;scanf(%d, t);while (t--){int n;scanf(%d, n);bool flag true;int i, tmp, num0;for (i0; in; i){scanf(%d, tmp);if (in-1 tmp ! num) flag false;if (tmp num) flag false;else num tmp - num;}if (flag)puts(yeah~ I escaped ^_^);elseputs(I will never go out T_T);}return 0;
} 转载于:https://www.cnblogs.com/xinyuyuanm/archive/2013/03/25/2980558.html