码迷,mamicode.com
首页 >  
搜索关键字:pairs    ( 1028个结果
lua实现switch
先上代码: function switch(val) local function innerfunc(t) for k,v in pairs(t) do if k == val then if type(v) == "function" then return v() elseif type(v) ...
分类:其他好文   时间:2016-10-03 17:03:22    阅读次数:185
HDU 1095 A+B for Input-Output Practice (VII)
Problem Description Your task is to Calculate a + b. Input The input will consist of a series of pairs of integers a and b, separated by a space, one ...
分类:其他好文   时间:2016-10-03 00:12:17    阅读次数:143
网络流(最大流):CodeForces 499E Array and Operations
You have written on a piece of paper an array of n positive integers a[1],?a[2],?...,?a[n] and m good pairs of integers (i1,?j1),?(i2,?j2),?...,?(im,? ...
分类:其他好文   时间:2016-10-02 23:53:56    阅读次数:243
[LeetCode] 22. Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: ...
分类:其他好文   时间:2016-10-02 00:41:14    阅读次数:129
【Lua】Lua中ipair和pair的区别
pairs会遍历table的所有键值对。 而ipairs就是固定地从key值1开始,下次key累加1进行遍历,如果key对应的value不存在,就停止遍历。顺便说下,记忆也很简单,带i的就是根据integer key值从1开始遍历的。 请看个例子。 输出结果就是: 因为tb不存在tb[4],所以遍历 ...
分类:其他好文   时间:2016-09-26 11:03:16    阅读次数:231
336. Palindrome Pairs
Given a list of unique words. Find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, i.e.words[i] + ...
分类:其他好文   时间:2016-09-22 06:33:21    阅读次数:150
Leetcode24--->Swap Nodes in Pairs(交换单链表中相邻的两个节点)
题目:给定一个单链表,交换两个相邻的节点,且返回交换之后的头节点 举例: Given 1->2->3->4, you should return the list as 2->1->4->3. 解题思路: 题目本身很简单,但是要注意一些细节: 1. 两对节点之间的连接 2. 如果只剩下一个节点,则不 ...
分类:其他好文   时间:2016-09-17 21:49:51    阅读次数:149
51nod 1290 Counting Diff Pairs 莫队 + bit
一个长度为N的正整数数组A,给出一个数K以及Q个查询,每个查询包含2个数l和r,对于每个查询输出从A[i]到A[j]中,有多少对数,abs(A[i] - A[j]) <= K(abs表示绝对值)。 Input Output ...
分类:其他好文   时间:2016-09-17 12:08:04    阅读次数:310
Palindrome Pairs
Given a list of unique words. Find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, i.e.words[i] + ...
分类:其他好文   时间:2016-09-12 12:19:16    阅读次数:107
lua lu
tb1 = {[2] = "123", [5] = "456", [9] ="789"} print(#tb1) 0 for i, key in pairs(tb1) do print(key)end for i, key in 1pairs(tb1) doprint(key)end ...
分类:其他好文   时间:2016-09-02 15:49:09    阅读次数:122
1028条   上一页 1 ... 57 58 59 60 61 ... 103 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!