任务一 #include <stdio.h> int main() { int num; scanf("%d",&num); printf("2049%04d\n",num); scanf("%d",&num); printf("2049%04d\n",num); scanf("%d",&num); ...
分类:
编程语言 时间:
2021-03-30 13:15:41
阅读次数:
0
1. 阻止事件冒泡 兼容w3c浏览器 function cBubble(e){ if(e.stopPropagation){ e.stopPropagation();//ie9+ }else{//ie678 e.cancelBubble = true; } } 2.阻止浏览器默认行为 functio ...
分类:
其他好文 时间:
2021-03-30 12:44:55
阅读次数:
0
Go入门(5)——defer 详解 关键字defer允许推迟到函数返回之前(或任意位置执行return语句后)才执行某个语句或者函数。return语句同样可以包含一些操作,所以可能存在将语句推迟到return之后的需求。关键字defer的用法类似于面向对象编程语言Java和C#的finally语句块 ...
分类:
其他好文 时间:
2021-03-29 12:52:57
阅读次数:
0
题目描述: 找出字符串中最长的回文子串长度 输入输出: Sample Input: Is PAT&TAP symmetric? Sample Output:Sample Output: 11 思路: dp的思想,设字符串str,dp[i][j] = 1 or 0 代表str[i] ~ str[j]间 ...
分类:
其他好文 时间:
2021-03-29 12:51:45
阅读次数:
0
在开发过程中,经常会忘了给创建时间、更新时间等字段赋值,这里介绍两种自动更新时间的方法: 方法一:beforeSave public function beforeSave($insert) { if (parent::beforeSave($insert)) { if ($insert) { if ...
分类:
其他好文 时间:
2021-03-29 12:46:44
阅读次数:
0
思路:利用逻辑符的短路性质设置递归边界。 剑指 Offer 64. 求1+2+…+n class Solution { int res = 0; public int sumNums(int n) { boolean x = n > 1 && sumNums(n-1) > 0; res += n; ...
分类:
其他好文 时间:
2021-03-29 12:40:44
阅读次数:
0
#include<iostream> using namespace std; int main() { int data[1010]; int n, sum = 0; int flag = 0; cin >> n; cin >> data[0] >> data[1]; flag = (data[1 ...
分类:
其他好文 时间:
2021-03-29 12:40:26
阅读次数:
0
思路:双指针从后往前遍历,根据第一个遇到的空格划分单词,使用StringBuilder拼接。 贴一下从后往前最后一个单词怎么拼接: 1.如果首位为字母,while(i >= 0 && s.charAt(i) != ' '),i为-1时进行拼接然后跳出大循环。 2.如果首位为空格,也类似,只是不用拼接 ...
分类:
其他好文 时间:
2021-03-29 12:24:40
阅读次数:
0
#include <stdio.h> #define NUMBER 100 int push(int* a, int top, int data) { a[++top] = data; return top; } int pop(int* a, int top) { if (top == -1) { ...
分类:
编程语言 时间:
2021-03-29 12:23:07
阅读次数:
0
相关描述 给你一个链表的头节点 head ,旋转链表,将链表每个节点向右移动 k 个位置。 方式一:简单方法 -- 通过不断拿到最后一个节点 和 删除最后节点的 链表头结点 进行头插入; static class ListNode { public int val; public ListNode ...
分类:
其他好文 时间:
2021-03-29 12:22:10
阅读次数:
0