- 博客(15)
- 资源 (2)
- 收藏
- 关注
原创 【toj1312】The Game
//时隔一年,再次做这个题,有一种不一样的感觉。。。 #include int a[50][50] = {0};int d[4][2] = {1,0, 1,1, 0,1, -1,1};bool dfs(int x, int y, int dir, int col, int s) { int xx = x + d[dir][0], yy = y + d[dir][1]; if (s
2014-11-30 17:18:39 721
原创 【最长上升子序列LIS】O(n^2)和O(nlogn)算法简记
最长上升子序列(Longest Increasing Subsquence)是指对一个序列,其中满足i LIS普遍求法为动态规划。有两种算法。第一种比较好写,复杂度O(n^2)。设原序列为a[]。所有下标从1开始(即[1,n])。定义dp[i]为以a[i]结尾的最长上升子序列的长度。很容易得到转移方程:dp[i] = max{1, dp[j] + 1} 且 j dp[i] = 1;
2014-11-30 10:20:48 947
原创 [poj1258 Agri-Net]最小生成树
复习了一下Kruskal。#include #include #include #include using namespace std;const int MAX = 128;struct edge { int from, to; int cost; bool operator<(const edge& B)const { return cost < B.cost;
2014-11-29 10:20:15 589
原创 [poj2349 Arctic Network]最小生成树
Arctic NetworkTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 10805 Accepted: 3542DescriptionThe Department of National Defence (DND) wishes to connect se
2014-11-29 10:17:42 595
原创 [poj1144 Network]tarjan求割点
NetworkTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 9767 Accepted: 4587DescriptionA Telephone Line Company (TLC) is establishing a new telephone cable
2014-11-29 10:08:58 561
原创 [poj1523 SPF]tarjan算法求割点
SPFTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 6304 Accepted: 2897DescriptionConsider the two networks shown below. Assuming that data moves around th
2014-11-29 10:04:01 646
原创 [poj2117 Electricity]求割点
ElectricityTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 4055 Accepted: 1366DescriptionBlackouts and Dark Nights (also known as ACM++) is a company that
2014-11-29 09:56:56 658
原创 [poj1833 排列]求数列的全排列中的后k项
排列Time Limit: 1000MS Memory Limit: 30000KTotal Submissions: 16791 Accepted: 6719Description题目描述:大家知道,给出正整数n,则1到n这n个数可以构成n!种排列,把这些排列按照从小到大的顺序(字典顺序)列出,如n=3时,列出1 2 3
2014-11-29 09:51:52 700
原创 [poj2777 Count Color]线段树
Count ColorTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 36607 Accepted: 11047DescriptionChosen Problem Solving and Program design as an optional course
2014-11-29 09:46:57 824
原创 [poj 2349]Arctic Network
题意:给p个点,要在这些点中选一些建立无线电站,使得每两个点之间都可以通讯。另外有s个通讯卫星,两个通讯卫星之间无论距离长短都可以自由通信。但是无线电站的规格必须相同,即任意两个无线电站的通讯距离是相同的。比如题目给的样例,我们可以选择(0,100)和(0,300)各建一个无线电站,它们之间通过无线电通信,(0,600)和(150,750)之间类似,然后这四个点被分为了两组,这两组之间通过卫星通信
2014-11-26 22:03:22 582
原创 [SDUSTOJ 1450]捡石子游戏
//捡石子#include #include const int MAX = 100;int a[MAX][MAX]; //a[i][j]默认为0,表示如果有i个石子Alice第一次取j个为输,a[i][j]=1则表示第一次取j个可以必胜 int main() { memset(a, 0, sizeof(a)); a[4][1] = 1; a[6][1] = 1; a[7]
2014-11-16 16:20:17 1404
原创 gvim解决中文乱码
"添加到.vset encoding=utf-8set fileencodings=utf-8,chinese,latin-1if has("win32")set fileencoding=chineseelseset fileencoding=utf-8endif"解决菜单乱码source $VIMRUNTIME/delmenu.vimsource $VI
2014-11-03 08:13:31 495
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人