04 2017 档案

摘要:Description Mike moved to a new city. There are bus stations in the city, each has a unique name. Each bus has its designated schedule, and sequential 阅读全文
posted @ 2017-04-28 22:49 Dilthey 阅读(247) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://poj.org/problem?id=3928 树状数组的应用。 把每个人当做裁判进行遍历,计算住在这个人之前的人中有多少个是比他弱的,记为pre_less[i],多少个人比他强的记为pre_more[i];同样的,住在他后面的人中,比他弱的记为suf_less[i],比他强 阅读全文
posted @ 2017-04-27 19:33 Dilthey 阅读(198) 评论(0) 推荐(0) 编辑
摘要:Time Limit: 1000MS Memory Limit: 65536K Description Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. J 阅读全文
posted @ 2017-04-25 20:34 Dilthey 阅读(300) 评论(0) 推荐(0) 编辑
摘要:思路来自http://blog.csdn.net/Courage_kn/article/details/69218592 用#define比定义一个lowbit函数快……不过好像很多时候不能像函数那样随便用,容易出问题…… 这是分别用 long long lowbit(long long x){re 阅读全文
posted @ 2017-04-24 21:27 Dilthey 阅读(256) 评论(0) 推荐(0) 编辑
摘要:首先本题需要用到扩展欧几里得算法…… 关于exgcd算法的一点简略证明: 那么,对于函数exgcd(a,b)=(d,x,y),其中d满足d=gcd(a,b); (x,y)满足ax+by=d; 则exgcd(b,a mod b)=(d,x',y'),而此时,使用 x = y' ; y = x' - f 阅读全文
posted @ 2017-04-23 20:33 Dilthey 阅读(297) 评论(0) 推荐(0) 编辑
摘要:Worried School Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 112 Accepted Submission(s): 34 Pr 阅读全文
posted @ 2017-04-22 20:52 Dilthey 阅读(301) 评论(0) 推荐(0) 编辑
摘要:感觉自己好咸鱼呀……B题写了这么久,虽然可以算作1A(忽略一次少include一个头文件的CE)…… 思想很简单,每次选定一个字符串作为目标字符串,然后把其他所有字符串都当做测试字符串,计算出总共需要的步数,再在这些计算出的步数中找到最小的那个就是答案。 阅读全文
posted @ 2017-04-22 00:13 Dilthey 阅读(223) 评论(0) 推荐(0) 编辑
摘要:N有N_cnt个约数,M有M_cnt个约数,那么总共有N_cnt * M_cnt种对应情况。 假设其中有D_cnt个对应结果是相等的,而这D_cnt个数正好是gcd(N,M)的所有约数。 例如: N=18 , M=42 18 = 1 * 18 ; 2 * 9 ; 3 * 6 ; N_cnt=6 42 阅读全文
posted @ 2017-04-19 23:04 Dilthey 阅读(193) 评论(0) 推荐(0) 编辑
摘要:解题思路参考:http://www.cnblogs.com/kuangbin/archive/2013/08/13/3255943.html 如果gcd(b[1...n])=d,那么b[1...n]中每个b[i]都应是d的倍数, 而b[1...n]是从a[1...n]修改k个数进而变过来的, 那么, 阅读全文
posted @ 2017-04-17 22:16 Dilthey 阅读(235) 评论(0) 推荐(0) 编辑
摘要:水题,只是想借此记一下gcd函数的模板 关于HDU1108,lcm( m , n ) = gcd( m , n ) * ( a / gcd( m , n ) ) * ( b / gcd( m , n ) ) = m * n / gcd( m , n ); 当然,我们知道,对于一个递归函数,将它用wh 阅读全文
posted @ 2017-04-17 13:35 Dilthey 阅读(312) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://poj.org/problem?id=2377 Time Limit: 1000MS Memory Limit: 65536K Description Bessie has been hired to build a cheap internet network among 阅读全文
posted @ 2017-04-12 12:31 Dilthey 阅读(163) 评论(0) 推荐(0) 编辑
摘要:题目翻译来自:http://poj.org/showmessage?message_id=97785 老老实实两次Dijkstra呗…… 两次都是从x点出发,第一次是按输入生成的正常的图,这样dijkstra后得到的是每头牛去参加宴会的最短时间, 第二次是将图上每条边都翻转一个方向后得到的图,这样d 阅读全文
posted @ 2017-04-10 22:43 Dilthey 阅读(242) 评论(0) 推荐(0) 编辑
摘要:Time Limit: 1000MS Memory Limit: 65536K Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is s 阅读全文
posted @ 2017-04-09 21:39 Dilthey 阅读(495) 评论(0) 推荐(0) 编辑
摘要:Time Limit: 1000MS Memory Limit: 65536K Description Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a curren 阅读全文
posted @ 2017-04-09 10:42 Dilthey 阅读(370) 评论(0) 推荐(0) 编辑
摘要:二分查找。 阅读全文
posted @ 2017-04-07 23:18 Dilthey 阅读(224) 评论(0) 推荐(0) 编辑
摘要:Time Limit: 5000MS Memory Limit: 65536K Description There are so many different religions in the world today that it is difficult to keep track of the 阅读全文
posted @ 2017-04-07 23:13 Dilthey 阅读(226) 评论(0) 推荐(0) 编辑
摘要:Time Limit: 1000MS Memory Limit: 65536K Description Windy has a country, and he wants to build an army to protect his country. He has picked up N girl 阅读全文
posted @ 2017-04-06 22:51 Dilthey 阅读(258) 评论(0) 推荐(0) 编辑
摘要:1 #include<cstdio> 2 #include<queue> 3 #include<cstring> 4 using namespace std; 5 int n,m,mv;char map[103][103];bool vis[103][103]; 6 struct type{ 7 i 阅读全文
posted @ 2017-04-05 23:06 Dilthey 阅读(170) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://poj.org/problem?id=3522 Time Limit: 5000MS Memory Limit: 65536K Description Given an undirected weighted graph G, you should find one of s 阅读全文
posted @ 2017-04-05 17:32 Dilthey 阅读(222) 评论(0) 推荐(0) 编辑
摘要:排序的水题,主要拿来测试了一下快速排序和归并排序哪个速度快一点。 当然单纯的一道题目其实完全说明不了什么问题…… 顺手再贴一个写法更加得劲儿一点的归并排序…… 阅读全文
posted @ 2017-04-04 10:26 Dilthey 阅读(183) 评论(0) 推荐(0) 编辑
摘要:Time Limit: 10000MS Memory Limit: 65536K Description An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a 阅读全文
posted @ 2017-04-02 11:05 Dilthey 阅读(221) 评论(0) 推荐(0) 编辑