码迷,mamicode.com
首页 >  
搜索关键字:循环 if for while case    ( 74454个结果
1010 一元多项式求导 (25 分)
如果求导之后没有任何非零项,需要输出0 0。 int main() { string line; getline(cin,line); stringstream ss(line); int a,b; bool first=true; while(ss>>a>>b) { a*=b; b--; if(b ...
分类:其他好文   时间:2021-02-16 11:53:11    阅读次数:0
0242. Valid Anagram (E)
Valid Anagram (E) 题目 Given two strings s and t , write a function to determine if t is an anagram of s. Example 1: Input: s = "anagram", t = "nagaram" ...
分类:其他好文   时间:2021-02-15 12:41:17    阅读次数:0
Vue2.x Class & Style Bindings
Intoduciton: The way of using '' in html part confused me when I was learning Class&Style Bindings in Vue's official guide.(of course it's also becaus ...
分类:其他好文   时间:2021-02-15 12:40:17    阅读次数:0
剑指 Offer 57. 和为s的两个数字
题意 在一个有序数组里找两个和为s的数字 思路 1??有序,立刻联想到二分查找,我们可以依次遍历数组中的每个数字,然后二分查找另一个数字使得和可以为s。 2??双指针的写法 一开始分别放在最左和最右,对应为最小和最大的数字,记两个指针指向的元素的和为sum 如果sum > target,说明太大,则 ...
分类:其他好文   时间:2021-02-15 12:36:24    阅读次数:0
增强for循环
public class demo3 { public static void main(String[] args) { // 增强for循环 <=> 数组或者集合对象的语法糖 int[] arr = {1,2,3,4,5,6}; // 最笨的方法 for(int i = 0; i < arr.l ...
分类:其他好文   时间:2021-02-15 12:35:46    阅读次数:0
KMP算法
KMP 算法(Knuth-Morris-Pratt 算法)是一个著名的字符串匹配算法。 对于字符串匹配,最简单的做法是暴力法双层循环依次对比。 int search(String pat, String txt) { int M = pat.length; int N = txt.length; f ...
分类:编程语言   时间:2021-02-15 12:27:03    阅读次数:0
1069 The Black Hole of Numbers (20 分)
注意不满$4$位的话要补成$4$位。 string s; set<int> S; int main() { cin>>s; while(s.size()<4) s='0'+s; while(true) { sort(s.begin(),s.end(),greater<char>()); string ...
分类:其他好文   时间:2021-02-15 12:21:49    阅读次数:0
python3之流程控制
一、流程控制 Python支持两种基本流程控制结构 分支结构: 根据条件选择不同的代码块执行 循环结构: 根据循环条件重复代码块 if语句用于分支结构 for-in, while用于循环结构 break, continue用于循环控制 二 、分支结构 1 if条件判断 格式 基本格式 if cond ...
分类:编程语言   时间:2021-02-15 11:55:35    阅读次数:0
Python-collections模块之defaultdict
defaultdict defaultdict 是 dict 类型的子类,正如其名,初始化时,可以给key指定默认值,什么意思呢?直接看代码。如果是普通的dict对象,访问一个不存在的key时,会报错: dict1 = dict() print(dict1['a']) """ Traceback ( ...
分类:编程语言   时间:2021-02-15 11:51:53    阅读次数:0
力扣228. 汇总区间
原题 1 class Solution: 2 def summaryRanges(self, nums: List[int]) -> List[str]: 3 left,right,lens,ans = 0,0,len(nums),[] 4 while left < lens: 5 right = ...
分类:其他好文   时间:2021-02-15 11:47:09    阅读次数:0
74454条   上一页 1 ... 73 74 75 76 77 ... 7446 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!