`
文章列表
http://acm.hdu.edu.cn/showproblem.php?pid=1385 题意: 找一个路径使得从一个地方坐的士到另一个地方花费最小,其中除了起点和终点,途中经过的站点要收费 Sample Input 5 0 3 22 -1 4 3 0 5 -1 -1 22 5 0 9 20 -1 -1 9 0 4 4 -1 20 4 0 5 17 8 3 1 1 3 3 5 2 4 -1 -1 0 Sample Output From 1 to 3 : Path: 1-->5-->4-->3 Total cost : 21 From 3 to 5 : Path: ...
http://acm.hdu.edu.cn/showproblem.php?pid=1142 Problem Description Jimmy experiences a lot of stress at work these days, especially since his accident made working difficult. To relax after a hard day, he likes to walk home. To make things even nicer, his office is on one side of a forest, and his ...
http://acm.hdu.edu.cn/showproblem.php?pid=1575 Problem Description A为一个方阵,则Tr A表示A的迹(就是主对角线上各项的和),现要求Tr(A^k)%9973。 Input 数据的第一行是一个T,表示有T组数据。 每组数据的第一行有n(2 <= n <= 10)和k(2 <= k < 10^9)两个数据。接下来有n行,每行有n个数据,每个数据的范围是[0,9],表示方阵A的内容。 Output 对应每组数据,输出Tr(A^k)%9973。 Sample Input 2 2 2 1 0 0 1 3 ...
http://acm.hdu.edu.cn/showproblem.php?pid=1217 题意:给出各种钱之间的兑换机制,求不断兑换后是否可以产生利润? 对于第一个案例:start with 1 US dollar and buy 0.5 * 10.0 * 0.21 = 1.05 US dollars, making a profit of 5 percent Sample Input 3 USDollar BritishPound ...
http://poj.org/problem?id=1679 题意:问最小生成树是否唯一 思路: 用Kruskal先求最小生成树,结果即为min,把所用到的边记录下来(这里是记录的对应的下表),然后枚举这些边, 每次去掉一个边再求一次最小生成树,结果为tmin,如果能构成最小生成树tmin==min,则说明最小生成树不唯一 Sample Input 2 3 3 1 2 1 2 3 2 3 1 3 4 4 1 2 2 2 3 2 3 4 2 4 1 2 Sample Output 3 Not Unique! 代码自己YY吧…… #include <iostream> ...
http://acm.hdu.edu.cn/showproblem.php?pid=2647 题意:先给出人数n和关系数m,再给出工人之间的工资大小关系,例如给出a b表示a>b,求老板至少要给多少工资【注:工人至少有888元的工资】 Sample Input 2 1 1 2 2 2 1 2 2 1 6 5 2 4 3 6 3 5 1 2 1 3 4 3 1 2 3 4 2 3 Sample Output 1777 -1 5532 3558 #include <iostream> #include <queue> using namespace st ...
http://acm.hdu.edu.cn/showproblem.php?pid=1695 题意:求[a,b]和[c,d]中分别取一个数,问取到的两个数的gcd=k的对数!!其中(2,3)跟(3,2)这2种类型只算一种,视为重复 Sample Input 2 1 3 1 5 1 1 11014 1 14409 9 Sample Output Case 1: 9 Case 2: 736427 #include <iostream> #include <fstream> #include <algorithm> #include <st ...
http://acm.hdu.edu.cn/showproblem.php?pid=1285 Problem Description 有N个比赛队(1<=N<=500),编号依次为1,2,3,。。。。,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的比赛成绩,只知道每场比赛的结果,即P1赢P2,用P1,P2表示,排名时P1在P2之前。现在请你编程序确定排名。 Input 输入有若干组,每组中的第一行为二个数N(1<=N<=500),M;其中N表示队伍的个数,M表示接着有M行的输入数据。接下来的M行数据中,每行也 ...
http://acm.hdu.edu.cn/showproblem.php?pid=1496 题意:求有多少个解!! Problem Description Consider equations having the following form: a*x1^2+b*x2^2+c*x3^2+d*x4^2=0 a, b, c, d are integers from the interval [-50,50] and any of them cannot be 0. It is consider a solution a system ( x1,x2,x3,x4 ) that veri ...
http://acm.hdu.edu.cn/showproblem.php?pid=1348 典型凸包题,求外围城墙的周长 Sample Input 1 9 100 200 400 300 400 300 300 400 300 400 400 500 400 500 200 350 200 200 200 Sample Output 1628 #include <iostream> #include <fstream> #include <algorithm> #include <string> #include <se ...
http://acm.hdu.edu.cn/showproblem.php?pid=1086 题意:求一堆线段两两相交的次数,即使交点重叠也算在内 更详细的几何讲解:http://dev.gameres.com/Program/Abstract/Geometry.htm#判断两线段是否相交 Sample Input 2 0.00 0.00 1.00 1.00 0.00 1.00 1.00 0.00 3 0.00 0.00 1.00 1.00 0.00 1.00 1.00 0.000 0.00 0.00 1.00 0.00 0 Sample Output 1 3 #include & ...
http://poj.org/problem?id=2318 题意:求每个被割线分离的区间内各有多少个点? Sample Input 5 6 0 10 60 0 3 1 4 3 6 8 10 10 15 30 1 5 2 1 2 8 5 5 40 10 7 9 4 10 0 10 100 0 20 20 40 40 60 60 80 80 5 10 15 10 25 10 35 10 45 10 55 10 65 10 75 10 85 10 95 10 0 Sample Output 0: 2 1: ...
此题乃师兄[ TT_last ]原创题!Orz膜拜一下 a simple problem Problem Description As we know , to caculate the sum ofis hard if the n is large,because today is Valentines Day,to make this problem more easy ,you only need to caculate the sum mod c Input There are multiply testcases. Each testcase, there is one line ...
http://poj.org/problem?id=1061 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1657 两题一模一样,只是无解时输出情况不同 首先由题意有【x+ms与y+ns建立等价关系,设次数为s】: x+ms ≡ (y+ns)(mol L) ->(x+ms)%L = (y+ns)%L ->((x+ms) - (y+ns))%L = 0 ->(x+ms) - (y+ns) = k*L 化简得: k*L + (n-m)*s = x-y 令a = L,b = n-m,n = x-y得 ak + ...
http://poj.org/problem?id=2478 Sample Input 2 3 4 5 0 Sample Output 1 3 5 9 求的是:sum(n) = phi(1) + phi(2) + phi(3) + ... + phi(n); 更多欧拉函数的说明:http://972169909-qq-com.iteye.com/blog/1131309 #include <iostream> #include <fstream> #include <algorithm> #include <string> # ...
Global site tag (gtag.js) - Google Analytics