水题~。 int n; bool isprime(int x) { if(x<2) return false; for(int i=2;i*i<=x;i++) if(x % i == 0) return false; return true; } bool palindrome(int x) { i ...
分类:
其他好文 时间:
2021-04-06 14:25:50
阅读次数:
0
02 add two numbers 1. 题目讲解 给定两个链表,每个链表表示一个整数,求这两个整数之和。结果也还是用链表表示。 2. 题解 思路: ? 本质上这道题是两个数带进位的加法。两个对应位置上的和是和对10取余。进位则是和整除10. class Solution { public: Li ...
分类:
其他好文 时间:
2021-04-06 14:12:17
阅读次数:
0
整理代码时发现的老代码,略微整理发上来,理论知识我就不细说了,大意就是这条线是所有点到这条线的垂直距离最短。 至于我写的对不对就由各位自己分辨,如果我写错请告诉我. GIF截图 代码 /// <summary> /// 简单最小二乘法 /// </summary> /// <param name=" ...
题意:求无向图去掉每一条边后的两两最短路之和 非标解 之前见过去掉每个点的两两最短路的问题,用的区间分治+Floyed,我想着边的也可以试一试,结果就过了。。。 设g(l,r)表示除了[l,r]区间内的边都加上了的情况下的两两最短路矩阵,那么有递推式$\left\{\begin{matrix}\be ...
分类:
其他好文 时间:
2021-04-06 14:09:28
阅读次数:
0
1.1 形参与实参 形参(形式参数):在定义函数阶段,定义的参数称之为形参,粗略的可以认为是变量名。 实参:在调用函数阶段传入的值称之为实际参数,简称实参,粗略的可以认为是变量值。 def ware_info(vendor_name, store_name, sku): return "{}商家下的 ...
分类:
其他好文 时间:
2021-04-05 12:43:51
阅读次数:
0
#include<bits/stdc++.h> using namespace std; int main(){ char s[105]; int x; scanf("%s%d",&s,&x); int ans=0; int len =strlen(s); for(int i=0;i<len;i++ ...
分类:
其他好文 时间:
2021-04-05 12:35:59
阅读次数:
0
#include<bits/stdc++.h> using namespace std; int main(){ char s[105]; int x,y; while(scanf("%d %d",&x,&y)!=EOF){ scanf("%s",s); int ans=0; int len=str ...
分类:
其他好文 时间:
2021-04-05 12:35:26
阅读次数:
0
链接:http://118.190.20.162/view.page?gpid=T42 代码: #include<bits/stdc++.h> using namespace std; vector<int> ve; int main (){ int n,num; cin>>n; for(int i ...
分类:
其他好文 时间:
2021-04-05 12:29:58
阅读次数:
0
难度 medium 给定两个字符串 text1 和 text2,返回这两个字符串的最长 公共子序列 的长度。如果不存在 公共子序列 ,返回 0 。 一个字符串的 子序列 是指这样一个新的字符串:它是由原字符串在不改变字符的相对顺序的情况下删除某些字符(也可以不删除任何字符)后组成的新字符串。 例如, ...
分类:
其他好文 时间:
2021-04-05 12:24:42
阅读次数:
0
Description: Given a string s and a string array dictionary, return the longest string in the dictionary that can be formed by deleting some of the gi ...
分类:
其他好文 时间:
2021-04-05 12:21:20
阅读次数:
0