随笔分类 - 算法
1
摘要:Find a way Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description Pass a year learning in Hangzhou, yife
阅读全文
摘要:非常可乐 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description 大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当s
阅读全文
摘要:Oil Deposits Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Problem Description The GeoSurvComp geologic survey comp
阅读全文
摘要:迷宫问题 Time Limit: 1000MS Memory Limit: 65536K Description 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0
阅读全文
摘要:Fire! Description Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the maze neglected to create a fire e
阅读全文
摘要:Fire Game Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each gri
阅读全文
摘要:Pots Time Limit: 1000MS Memory Limit: 65536K Description You are given two pots, having the volume of A and B liters respectively. The following opera
阅读全文
摘要:Shuffle'm Up Time Limit: 1000MS Memory Limit: 65536K Description A common pastime for poker players at a poker table is to shuffle stacks of chips. Sh
阅读全文
摘要:Prime Path Time Limit: 1000MS Memory Limit: 65536K Description The ministers of the cabinet were quite upset by the message from the Chief of Security
阅读全文
摘要:Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Description Given a positive integer n, write a program to find out a nonzero multiple m of
阅读全文
摘要:Fliptile Time Limit: 2000MS Memory Limit: 65536K Description Farmer John knows that an intellectually satisfied cow is a happy cow who will give more
阅读全文
摘要:Catch That Cow Time Limit: 2000MS Memory Limit: 65536K Description Farmer John has been informed of the location of a fugitive cow and wants to catch
阅读全文
摘要:Dungeon Master Time Limit: 1000MS Memory Limit: 65536K Description You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon
阅读全文
摘要:棋盘问题 Time Limit: 1000MS Memory Limit: 10000K Description 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行
阅读全文
摘要:背包问题 01背包问题 static const int N = 1010; int dp[N][N], v[N], w[N], n, c; int main(){ cin >> n >> c; for(int i = 1; i <= n; i ++ ) cin >> v[i]
阅读全文
摘要:树状数组 动态区间和询问 + 点修改 int lowbit(int x){ return x & -x; } void add(int x, int v){ for(int i = x; i <= n; i += lowbit(i)) tree[i] += v; } int query(int x)
阅读全文
摘要:拓扑排序 bool topo(){ queue<int> q; for(int u = 1; u <= n; u ++ ) if(!ind[u]) q.push(u); int cnt = 0; while(!q.empty()){ int u = q.front(); q.pop(); cnt +
阅读全文
摘要:递归实现枚举 递归实现指数型枚举 void dfs(int k){ if(k > n) { for(auto &x : res) cout << x << ' '; cout << endl; return; } dfs(k + 1); res.push_back(k); dfs(k + 1); r
阅读全文
摘要:模拟链表 单链表(链式前向星) void add_h(int x){ e[idx] = x, ne[idx] = h, h = idx ++ ; } //在第k个后面插入节点 void add(int k, int x){ e[idx] = x, ne[idx] = ne[k], ne[k] = i
阅读全文
摘要:排序 快速排序 线性时间选择 int partition(int l, int r){ int pos = rand() % (r - l + 1) + l; swap(a[pos], a[l]); int key = a[l], i = l, j = r; while(i != j){ while
阅读全文
1

浙公网安备 33010602011771号