- 博客(13)
- 收藏
- 关注
原创 CF 103div2 D(dijkstra)
题目意思是找在图中与原点距离为l的点的个数,这些点可以在图中的点上,也可以在边上。先用dijkstra求出原点到各个点的最短距离,然后先扫一遍点,加上距离为l的点,再扫一遍边,分几种情况去判断在边上能有几个符合条件的点(1个或2个),这里写的时候仔细点就可以了。#include#include#include#include#include #includeusing na
2013-07-31 17:51:08 812
原创 cf 80 div1 B(graph)
题目意思翻译过来后就是让你判断一个图是否联通,且恰只包含一个环。比较笨的方法是先判联通,然后找出那个环,然后再dfs判环是否唯一。但是其实在判联通后,只需再看n是否等于m即可,因为图如果联通,且点数等于边数,又无重边和自环,则图中一定有且只有一个环。#include#include#include#include#include #include#include #include
2013-07-31 11:14:04 1219
原创 cf 100 c(greedy)
C. New Year Snowmentime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs meticulous Gerald sets the table and
2013-07-27 22:59:46 709
原创 hdu 4619
Warm up 2Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 73 Accepted Submission(s): 34Problem Description Some 1×2 dominoes
2013-07-25 18:53:16 796
原创 CF 127 div1 A
A. Clear Symmetrytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputConsider some square matrix A with side n
2013-07-24 20:14:43 1303
原创 CF 148 div1 A
A. Not Wool Sequencestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA sequence of non-negative integers a1
2013-07-24 19:10:55 1018
原创 CF 131 div2 B
B. Hometasktime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFurik loves math lessons very much, so he doesn
2013-07-22 21:59:15 892
原创 CF 143 div2 C
C. To Add or Not to Addtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA piece of paper contains an array
2013-07-20 10:26:12 936
原创 CF 154 div2 B(dp)
B. Physics Practicaltime limit per test1 secondmemory limit per test256 megabytesinputinput.txtoutputoutput.txtOne day Vasya was on a physics practical, perform
2013-07-18 22:33:58 1074
原创 CF 141 div2 D(2-SAT)
E. The Road to Berland is Paved With Good Intentionstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBerlan
2013-07-18 20:29:17 1088
原创 CF Croc Champ 2013 - Finals (online version, Div. 1) C(greedy)
贪心,但容易想错。对每一个块,要找一个恰比它大的内存去存他。但是,不是直接用所给的内存数据去处理,而是先把每个内存分为2^i。(要想到这里应该注意到所给数据的特殊性,2^bi),否则贪心是错误的。然后就是找每个块恰好比它大的,用模拟进制减法的方式去做,当前位如果a[i]比b[i]大,那么ans直接加b[i],否则a要向前面借位,具体做法见代码。如果能够借到足够的数,那就ans+=b[i],否则an
2013-07-18 12:39:34 893
原创 CF 191 div2 C
这倒题找出规律不难,关键是有mod运算,还要求等比数列,直接用公式求,存在除法,不行,所以采用二分的方式。#include #include #include #include #include #include #include #include typedef long long LL;using namespace std;const int maxn = 500 +
2013-07-17 14:56:53 1852
原创 CF 190div2 D(贪心)
容易想到需要思考能否把对面全部杀死,如果能,那么。。。不能,则一定不会去杀防守的。贪心的思路大致有了方向,然后,不能的话,要怎么做呢?策略是用我这边最大的比对手最小的。证明如下,假设我手上的任意一张牌x1和最大的牌x2(x1 y2(否则一个都杀不死),如果y1 然后考虑能把对面全部杀死,还是贪心策略,对于对手防守状态的牌,我就用恰比它大的杀死它,剩下的伤害计算与安排的顺序无关,结果是su
2013-07-16 21:32:30 948
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人