摘要:
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 阅读全文