res

【Template】

帅比萌擦擦* 提交于 2019-12-12 05:14:23
# include <bits/stdc++.h> using namespace std ; # include <glog/logging.h> # include <gflags/gflags.h> DEFINE_string ( ip , "100" , "ok" ) ; /************************************* in --- out **********************************/ using ll = long long ; # define dbg(x) cout << #x << " = " << x << endl; # define dbg2(x1, x2) cout << #x1 << " = " << x1 << " " << #x2 << " = " << x2 << endl; template < typename T > void W ( T x ) { dbg ( x ) ; } template < typename T > void W ( T x , T y ) { dbg2 ( x , y ) ; } template < typename T > void W ( vector < T > Vector ) { dbg ( Vector . size ( ) ) ; for (

封装http请求

こ雲淡風輕ζ 提交于 2019-12-11 20:32:50
let dom = "http://192.168.28.206:8027" ; function thenCallBack ( res , then , cat ) { console . log ( res ) ; if ( res . data . code == 200 ) { then . call ( this , res ) ; } else { this . $message ( { message : res . data . msg , type : "error" } ) ; cat . call ( this , res ) ; } } function post ( url , data , then , cat ) { if ( data instanceof Function ) { cat = then ; then = data ; data = undefined ; } if ( ! cat ) { cat = res => { } ; } var url = dom + url ; this . $axios . post ( url , data ) . then ( res => { thenCallBack . call ( this , res , then , cat ) ; } ) } function get ( url ,

leetcode刷题python之字符串相乘

ぃ、小莉子 提交于 2019-12-08 06:16:48
class Solution: def multiply(self, num1: str, num2: str) -> str: if num1 == '0' or num2 == '0': return '0' num1 = num1[::-1] num2 = num2[::-1] result = [0] * (len(num1) + len(num2)) for index1 , i1 in enumerate(num1): # n1 = int(i1) for index2 , i2 in enumerate(num2): # n2 = int(i2) sum = result[index1 + index2] + int(i1)*int(i2) result[index1 + index2] = sum % 10 result[index1 + index2 + 1] += sum // 10 res = ''.join([ str(x) for x in result ])[::-1].lstrip('0') # res = ''.join(res) # res = res[::-1] # res = res.lstrip('0') return res 来源: CSDN 作者: leileii 链接: https://blog.csdn.net/leileii

LeetCode 38. 报数(C++、python)

巧了我就是萌 提交于 2019-12-07 05:38:18
38. 报数 报数序列是一个整数序列,按照其中的整数的顺序进行报数,得到下一个数。其前五项如下: 1. 1 2. 11 3. 21 4. 1211 5. 111221 1 被读作 "one 1" ( "一个一" ) , 即 11 。 11 被读作 "two 1s" ( "两个一" ), 即 21 。 21 被读作 "one 2" , " one 1" ( "一个二" , "一个一" ) , 即 1211 。 给定一个正整数 n (1 ≤ n ≤ 30),输出报数序列的第 n 项。 注意:整数顺序将表示为一个字符串。 示例 1: 输入: 1 输出: "1" 示例 2: 输入: 4 输出: "1211" C++ class Solution { public: string countAndSay(int n) { string res="1"; string tmp; for(int i=2;i<=n;i++) { tmp=res; res=""; int m=tmp.length(); int j=1; int count=1; while(j<m) { if(tmp[j]==tmp[j-1]) { count+=1; } else { res+=to_string(count); res+=tmp[j-1]; count=1; } j++; } res+=to_string

demo示例的layui 分页

橙三吉。 提交于 2019-12-05 22:46:56
一、主要是实现在自己特定的表格中的追加自己想要的数据。首先肯定是导入demo中的css和js文件,其次就是需要将innerHtml改成outerHTML,具体的区别自己去研究一下JavaScript官文文档。 @model IEnumerable<LanguageDto> <style type="text/css"> #customers { font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; width: 100%; border-collapse: collapse; } #customers td, #customers th { font-size: 1em; border: 1px solid #98bf21; padding: 3px 7px 2px 7px; } #customers th { font-size: 1.1em; text-align: left; padding-top: 5px; padding-bottom: 4px; background-color: #A7C942; color: #ffffff; } #customers tr.alt td { color: #000000; background-color: #EAF2D3; } </style> <div class

Leetcode题目337:打家劫舍 III(树形DP-中等)

僤鯓⒐⒋嵵緔 提交于 2019-12-05 19:07:40
题目描述: 在上次打劫完一条街道之后和一圈房屋后,小偷又发现了一个新的可行窃的地区。这个地区只有一个入口,我们称之为“根”。 除了“根”之外,每栋房子有且只有一个“父“房子与之相连。一番侦察之后,聪明的小偷意识到“这个地方的所有房屋的排列类似于一棵二叉树”。 如果两个直接相连的房子在同一天晚上被打劫,房屋将自动报警。 计算在不触动警报的情况下,小偷一晚能够盗取的最高金额。 示例 1: 输入: [3,2,3,null,3,null,1] 3 / \ 2 3 \ \ 3 1 输出: 7 解释: 小偷一晚能够盗取的最高金额 = 3 + 3 + 1 = 7. 示例 2: 输入: [3,4,5,1,3,null,1] 3 / \ 4 5 / \ \ 1 3 1 输出: 9 解释: 小偷一晚能够盗取的最高金额 = 4 + 5 = 9. 思路分析: (这是一个很经典的树形dp问题) 我们可以先不管这个否是二叉树,我们发现,如果我们选了 cur 这个节点 那么就说明 我们不能选它的所有子节点(还有父节点)。 对于每一个节点,都只有选和不选两种情况。我们每次考虑一棵子树,那么根只有两种情况,选和不选(我们让dp[0]表示不选,dp[1]表示选)。 对于选择了根,那么我们就不能选它的儿子了 如果没有选根,我们就可以任意选了(即选最大的那一个) 然后我们做一次dfs即可 代码实现: /** *

nodejs--express

元气小坏坏 提交于 2019-12-05 14:48:04
路由渲染 res.render() 传参:优先级第一种比第二种高,但是第一种传参只针对当前页面,第二种可以把这个参数绑定在res上全局都可用 1.res.render('open-courses',{foo:'bar'}); 2.res.locals.foo='bar' 默认公共模版:layout.hbs 想要修改渲染的模版可以在render里指定layout:'layout2' res.render('open-courses',{layout:'layout2',foo:'bar'}); 来源: CSDN 作者: dasiy_j 链接: https://blog.csdn.net/dasiy_j/article/details/84137756

封装jq的ajax

非 Y 不嫁゛ 提交于 2019-12-05 07:03:04
function getData(url,ops,func){ type = "get"; url = apiurl + url; $.ajax({ type: type, url:url , dataType: "json", data: ops, error: function (err) { //请求失败时被调用的函数 console.log("失败:" + err); }, success: function (res) { func(res) } }); } 调用 getData(getMerSupCount,{},function(res){ $(".head .num01").html(res.data.merCount); $(".head .num02").html(res.data.supCount); }) es6 promise封装方法 function Getdata(url,ops,type){ //默认get url = apiurl + url; //线上http: // url = 'http://192.168.2.101:7001/'+url;//线下 var promiseObj = new Promise(function(resolve, reject) { $.ajax({ type:type, url:url, data: ops,

ant-design-vue 上传图片组件

微笑、不失礼 提交于 2019-12-05 02:53:38
<a-upload name="multipartFile" listType="picture-card" class="avatar-uploader" :showUploadList="false" action="自己的api" headers="{token:'token值'}" :beforeUpload="beforeUpload" @change="handleFrontImgChange"> <a-popover v-if="idCardFront" placement="top"> <template slot="content"> <img style="width:100%" :src="idCardFront" alt="正面" /> </template> <a-icon v-if="loadingFront" type="loading" /> <img v-else style="width:100%" :src="idCardFront" alt="正面" /> </a-popover> <div v-else> <a-icon :type="loadingFront ? 'loading' : 'plus'" /> <div class="ant-upload-text">上传</div> </div> </a-upload>   

Python内置函数

女生的网名这么多〃 提交于 2019-12-04 19:55:45
abs() 绝对值 1 print(abs(-5)) #都变成正数 all() 判断 1 #一个为假,就为假 # 0 空 None Flase 2 print(all([1,'a',0]))#False 3 # 列表中所有元素的布尔值为真,最终结果才为真 4 print(all('')) 5 # 传给all的可迭代对象如果为空,最终结果为真 any() 判断 1 #但凡有一个为真,就为真 2 # print(any([0,'',None,1])) 3 print(any([])) 4 # 传给any的可迭代对象如果为空,最终结果为假 进制转换 1 print(bin(11)) #10-2 2 print(oct(11)) #10-8 3 print(hex(11)) #10-16 bool() 布尔值 1 print(bool(0))#0, None,空的布尔值为假 .encode() 转类型 1 res = '你好songhaiixng'.encode('utf-8') 2 print(res) #转成了bytes类型 3 4 res = bytes('你好songhaixing',encoding='utf-8') 5 print(res) #同上面一样 callable() 调用 1 def func(): 2 pass 3 print(callable(func)) 4