原题地址:https://oj.leetcode.com/problems/rotate-image/题意:You
are given annxn2D matrix representing an image.Rotate the image by 90 degrees
(clockwise).Fo...
分类:
编程语言 时间:
2014-06-11 09:43:59
阅读次数:
1264
原题地址:https://oj.leetcode.com/problems/powx-n/题意:Implement
pow(x,n).解题思路:求幂函数的实现。使用递归,类似于二分的思路,解法来自Mark Allen Weiss的《数据结构与算法分析》。代码:class
Solution: #...
分类:
编程语言 时间:
2014-06-11 08:59:33
阅读次数:
317
原题地址:https://oj.leetcode.com/problems/edit-distance/题意:Given
two wordsword1andword2, find the minimum number of steps required to
convertword1toword2....
分类:
编程语言 时间:
2014-06-11 08:58:49
阅读次数:
293
题目:http://icpc.ahu.edu.cn/OJ/Problem.aspx?id=517之前差分约束搞了一发,现在终于知道贪心了。对区间右端点排序,尽量从右端点取数。
数据比较小,n^2就行了。#include #include #include #include #include #inc...
分类:
其他好文 时间:
2014-06-11 08:21:10
阅读次数:
276
题目来源:Light OJ 1278 Sum of Consecutive Integers
题意:N拆分成连续整数和的方案数
思路:奇因数的个数
#include
#include
#include
#include
using namespace std;
//筛素数
const int maxn = 10000010;
bool vis[maxn];
int prime[10...
分类:
其他好文 时间:
2014-06-08 15:34:09
阅读次数:
295
题目来源:Light OJ 1251 Forming the Council
题意:若干了条件至少满足一个 求是否有方案 输出任意一种可能的方案 留下的人的个数
思路:2-SAT基础题
#include
#include
#include
using namespace std;
const int maxn = 100010;
int n, m;
vector G[maxn*2];...
分类:
其他好文 时间:
2014-06-08 08:15:18
阅读次数:
261
题目来源:Light OJ 1026 Critical Links
题意:输出桥
思路:模版
#include
#include
#include
#include
#include
using namespace std;
const int maxn = 10010;
struct Edge
{
int u, v;
Edge(){}
Edge(int u, int v):...
分类:
其他好文 时间:
2014-06-08 04:07:05
阅读次数:
235
题目来源:Light OJ 1291 Real Life Traffic
题意:最少添加几条边 可以使全图边双连通
思路:缩点 重新构图 答案就是(叶子节点数+1)/ 2
#include
#include
#include
#include
#include
using namespace std;
const int maxn = 10010;
struct Edge
{
i...
分类:
其他好文 时间:
2014-06-08 02:57:26
阅读次数:
276
题目:Given a linked list and a valuex, partition it
such that all nodes less thanxcome before nodes greater than or equal tox.You
should preserve the or...
分类:
其他好文 时间:
2014-06-07 20:35:55
阅读次数:
236
3595: [Scoi2014]方伯伯的OjTime Limit: 6 SecMemory
Limit: 256 MBSubmit: 102Solved:
54[Submit][Status]Description方伯伯正在做他的Oj。现在他在处理Oj上的用户排名问题。Oj上注册了n个用户,编号为1...
分类:
其他好文 时间:
2014-06-07 17:01:57
阅读次数:
870