时间限制:0.25s空间限制:12M题意 给定一个合法的仅由'(',')'组成的括号序列,求它的下一个合法排列.假定'('f[j]; 将最后的‘)’和‘(’ 交换位置,再把后面所以的括号反转。即可得到我们需要的解。code:#include #include #include usi...
分类:
其他好文 时间:
2014-07-19 20:07:16
阅读次数:
252
Clone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.OJ's undirected graph serialization:Nodes are labeled uniq...
分类:
其他好文 时间:
2014-07-19 12:11:53
阅读次数:
238
这些天好颓啊。。都没有A题,只是各种等着填的坑。。简直、、这道题。。。。其实是快速幂模板题。。为了学习矩阵快速幂,顺手复习下快速幂。。。哈工大的OJ其实还挺友好的。速度也快。。赞一个。。翻译 给你两个数A,B,要你求(1b + 2b + ... + ab) 这个式子mod a的结果。(b是奇数) 每...
分类:
其他好文 时间:
2014-07-19 09:19:19
阅读次数:
245
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes are labeled u...
分类:
其他好文 时间:
2014-07-19 00:05:00
阅读次数:
201
DescriptionConsidering a light entering three adjacent planes of glass.At any meeting surface, the light may either reflect or continue straight throu...
分类:
其他好文 时间:
2014-07-18 21:11:27
阅读次数:
207
Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjace...
分类:
其他好文 时间:
2014-07-18 17:21:54
阅读次数:
293
下面给出的题目共计560道,去掉重复的也有近500题,作为ACMer Training Step1,用1年到1年半年时间完成。打牢基础,厚积薄发。一、UVaOJhttp://uva.onlinejudge.org西班牙Valladolid大学的程序在线评测系统,是历史最悠久、最著名的OJ。二、《算法...
分类:
其他好文 时间:
2014-07-18 11:39:04
阅读次数:
483
A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message conta...
分类:
其他好文 时间:
2014-07-16 18:20:59
阅读次数:
155
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.下面是百度得到的关于罗马数的解释:我的代码: 1 class Solution { 2 ...
分类:
其他好文 时间:
2014-07-16 18:00:22
阅读次数:
214
要点:要考虑到各种非法参数。
实现:
/**********************************
字符串转整数
by Rowandjj
2014/7/15
***********************************/
#include
#include//不加这个头文件在九度oj上会编译错误
using namespace std;
int stat...
分类:
其他好文 时间:
2014-07-16 17:35:09
阅读次数:
194