![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
文章平均质量分 64
L1858
这个作者很懒,什么都没留下…
展开
-
LCOJ - Largest Number
Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is9534330.Note: The result may be very原创 2015-01-26 21:03:29 · 349 阅读 · 0 评论 -
Sicily 1153. 马的周游问题
// DFS,须剪枝#include #include #include using namespace std;int k, res[64];bool visit[64];int direct[][2] = { { -2, 1 }, { -1, 2 }, { 1, 2 }, { 2, 1 }, { 2, -1 }, { 1, -2 }, { -1, -2 }, { -2,原创 2014-11-02 20:36:22 · 328 阅读 · 0 评论 -
Sicily 1121. Tri Tiling
#include using namespace std;long long d[31];void dp() { for (int i = 4; i < 31; i += 2) { d[i] = 3 * d[i - 2]; // i)3个块组成独立矩形 // ii)不可垂直分割,作为整体,方案数累加 for (int j = 0;原创 2014-10-18 20:55:04 · 558 阅读 · 0 评论 -
Sicily 1090. Highways
// MST#include #include #include using namespace std;struct Edge { int from; int to; int weight;} e[125050];int p[505];bool cmp(Edge a, Edge b) { return a.weight < b.weight;}// 根节点:本原创 2014-10-19 20:38:20 · 421 阅读 · 0 评论 -
Sicily 1155. Can I Post the lette
// 从起点开始DFS会TLE,逆向思维:从终点开始,AC#include #include using namespace std;bool r[202][202];int n, m;bool flag;void find(int dst) { if (!dst) { flag = true; return; } for (int i = 0; i < n; i原创 2014-10-20 18:25:49 · 486 阅读 · 0 评论 -
Sicily 1342. 开心的金明
// 从后向前的递推。未知子状态用0占位,随后更新#include using namespace std;int dp[30030], v[30], p[30];int main(int argc, char **argv) { int n, m; while (cin >> n >> m) { for (int i = 0; i <= n; i++) dp[i] =原创 2014-10-27 19:47:00 · 473 阅读 · 0 评论 -
LCOJ - Intersection of Two Linked Lists
Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists: A: a1 → a2 ↘原创 2014-12-22 19:57:40 · 389 阅读 · 0 评论 -
LCOJ - Majority Element
Given an array of size n, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element alw原创 2014-12-22 19:50:30 · 242 阅读 · 0 评论 -
LCOJ - Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB // 进制转换原创 2014-12-22 21:20:28 · 371 阅读 · 0 评论 -
Sicily 1200. Stick
// a ^ (b ^ b) ^ (c ^ c) ^ ... ^ (n ^ n) = a#include using namespace std;int main(int argc, char **argv) { int n; while (cin >> n && n) { int res, tmp, nt = n - 1; cin >> res; while (nt--原创 2014-10-20 19:31:03 · 321 阅读 · 0 评论 -
Sicily 1171. The Game of Efil
// DFS#include #include #include using namespace std;int m, n;int res;int dx[8] = { -1, -1, 0, 1, 1, 1, 0, -1 };int dy[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };int d[16][16], tar[16][16];void c原创 2014-12-22 18:16:42 · 594 阅读 · 0 评论 -
LCOJ - Max Points on a Line
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. // max_point = max number of [a point and others on a line] = same + same slope// max_plane = m原创 2015-02-23 18:08:47 · 314 阅读 · 0 评论