自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(16)
  • 收藏
  • 关注

原创 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 307

原创 LCOJ - Fraction to Recurring Decimal

Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating, enclose the repeating part in parentheses.For

2015-02-23 13:20:44 404

原创 UVA 1594 - Ducci Sequence

// map#include using namespace std;int n;vector old,now;map,bool> m;void gen(){ for(size_t i=0;i<old.size();i++) now[i]=abs(old[i]-old[(i+1)%n]); for(size_t i=0;i<old.size();i++) old[i]

2015-01-31 17:10:53 320

原创 LCOJ - Maximum Gap

Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 if the array contains less than 2 elements.Y

2015-01-30 22:03:39 409

原创 LCOJ - Compare Version Numbers

Compare two version numbers version1 and version1.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.You may assume that the version strings are non-empty and cont

2015-01-29 16:54:10 289

原创 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 343

原创 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 366

原创 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 380

原创 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 238

原创 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 590

原创 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 322

原创 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 467

原创 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 316

原创 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 479

原创 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 416

原创 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 552

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除